Banner Home Page DIY Contests Problems Ranklist Status Statistics
1003数据时完整的数据 暴力好像是过不去的啦~

C.时间挑战

Time Limit : 3000/1000ms (Java/Other)   Memory Limit : 65535/32768K (Java/Other)
Total Submission(s) : 91   Accepted Submission(s) : 23

Font: Times New Roman | Verdana | Georgia

Font Size:

Problem Description

今天我们将接受一场关于时间的挑战,游戏规则如下:
给出N(1 < = N < = 200000)段时间,每段时间表示为[A,B],A为起始时间,B为终止时间。
对于两个时间段s和t,我们说s被t包括, At <= As 而且 Bs <= Bt。
请注意:如果At==As 并且 Bt==Bs的话,我们不认为s被t包括。
那么在所有N段时间中,对于每个时间段,你能告诉我他被多少时间段包括了么?

Input

输入包含多个测试用例。为每个测试用例中,第一行是一个整数N(1 < = N < = 200000)。
然后再N行,每行包含两个整数:Ai和Bi(Ai,Bi将不超过32位的无符号整数)。Ai、Bi如上述题意描述。

Output

对于每个测试样例,只需输出一行,该行包括n个整数,第i个数代表了(Ai,Bi)被多少时间段包括。

Sample Input

2
8467 14802
6500 15670
5
3 7
2 7
0 1
1 4
1 3

Sample Output

1 0
1 0 0 0 1

Author

syu

Source

Developing School's Contest 6

Statistic | Submit | Back