不得不说是一道比较烦人的题。。细节比较多
由于没给xy范围所以必须先离散化。。之后再开2个BIT,以y值为下标维护点的个数,在枚举x时,一个BIT维护x左边的点个数,另一个维护x右边的点,然后在枚举的时候主要按点对BIT进行维护,对每个点进行差分求方案,对每个x求得最优方案后还要记录方案来求oli的得分。。
然后记得输出oli得分要去重。。
Brownie Points II
Time Limit: 5000MS | | Memory Limit: 65536K |
Total Submissions: 2744 | | Accepted: 884 |
Description
Stan and Ollie play the game of Odd Brownie Points. Some brownie points are located in the plane, at integer coordinates. Stan plays first and places a vertical line in the plane. The line must go through a brownie point and may cross many (with the same x-coordinate). Then Ollie places a horizontal line that must cross a brownie point already crossed by the vertical line.
Those lines divide the plane into four quadrants. The quadrant containing points with arbitrarily large positive coordinates is the top-right quadrant.
The players score according to the number of brownie points in the quadrants. If a brownie point is crossed by a line, it doesn't count. Stan gets a point for each (uncrossed) brownie point in the top-right and bottom-left quadrants. Ollie gets a point for each (uncrossed) brownie point in the top-left and bottom-right quadrants.
Stan and Ollie each try to maximize his own score. When Stan plays, he considers the responses, and chooses a line which maximizes his smallest-possible score.
Input
Input contains a number of test cases. The data of each test case appear on a sequence of input lines. The first line of each test case contains a positive odd integer 1 < n < 200000 which is the number of brownie points. Each of the following n lines contains two integers, the horizontal (x) and vertical (y) coordinates of a brownie point. No two brownie points occupy the same place. The input ends with a line containing 0 (instead of the n of a test).
Output
For each input test, print a line of output in the format shown below. The first number is the largest score which Stan can assure for himself. The remaining numbers are the possible (high) scores of Ollie, in increasing order.
Sample Input
11 3 2 3 3 3 4 3 6 2 -2 1 -3 0 0 -3 -3 -3 -2 -3 -4 3 -7 0
Sample Output
Stan: 7; Ollie: 2 3;
Source
[Submit] [Go Back] [Status] [Discuss]