Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
Home Page
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Update your info
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
User ID:
Password:
  Register
Language:
Cow School
Time Limit: 2000MSMemory Limit: 65536K
Total Submissions: 786Accepted: 233

Description

Bessy is going to school and doing well. She has taken N (1 ≤ N ≤ 5000 -- except one case where 1 ≤ N ≤ 50,000) tests and recorded the scores (Ti points out of Pi points for test i; 0 ≤ TiPi < 40,000; 0 < Pi) as this task's input.

Her teacher will drop the D tests with the lowest percentage (TiPi) before calculating Bessie's final grade (which is the sum of the remaining test score points over the sum of the remaining total test points). Bessy is good at math and quickly realizes that this does not benefit her as much as it might.

To prove her point, Bessy wants to find all values of D for which she could have ended up with a higher grade by choosing to drop different tests than the teacher would have. Help her by finding and printing all values of D for which this is possible.

Bessy has noted that, amazingly, she has never scored the same percentage on two different tests.

Input

Line 1: A single integer, N
Lines 2..N+1: Line i+1 contains two space-separated integers: Ti and Pi

Output

Line 1: A single integer K (0 ≤ KN) that is the number of values of D for which Bessy could have ended up with a higher grade by dropping a different set of D tests than the teacher.
Lines 2..K+1: The values of D for which this is true, in ascending numerical order.

Sample Input

5
1 2
5 9
3 8
4 10
1 3

Sample Output

2
1
2

Source

[Submit]   [Go Back]   [Status]   [Discuss]

Home Page   Go Back  To top


All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator