[BOJ 13864] Marathon
View as PDFYou’ve began running long distances. Simplistically, the road on which athletes race is a straight, infinite line. At some point in time all participants split into n groups of ki people each. Each group at this point in time is at coordinate xi . We know that if a group consists of D people, the group’s speed is 100/D. All groups move in the direction of coordinate’s growth. If one team catches another, they merge and their speed changes accordingly (more than two groups can merge simultaneously).</p>
Since the road is infinite, from some point in time no more merges are possible. You, as a beginner, are interested in the number of groups remaining and the number of people in each of them.
입력 형식
The first line contains an integer n (1 ≤ n ≤ 105 ). Each of the following n lines contains the number ki of people in the corresponding group and its coordinate xi (xi - real numbers with no more than three decimal digits and their absolute values do not exceed 104 , 1 ≤ ki ≤ 100, all the coordinates are different).
출력 형식
The first line of output contains the number of groups m. The second line contains m integers - the number of people in each of these groups, in any order.
예제 입력
4
1 0
2 9000
4 1
3 10000
예제 출력
2
5 5
Comments