当前你的浏览器版本过低,网站已在兼容模式下运行,兼容模式仅提供最小功能支持,网站样式可能显示不正常。
请尽快升级浏览器以体验网站在线编辑、在线运行等功能。

建议使用的浏览器:

谷歌Chrome 火狐Firefox Opera浏览器 微软Edge浏览器 QQ浏览器 360浏览器 傲游浏览器

3266:Cow School

题目描述

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.

输入解释
Line 1: A single integer, N
Lines 2..N+1: Line i+1 contains two space-separated integers: Ti and Pi
输出解释
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.
输入样例
5
1 2
5 9
3 8
4 10
1 3
输出样例
2
1
2

该题目是Virtual Judge题目,来自 北京大学POJ

源链接: POJ-3266

最后修改于 2020-10-29T06:57:14+00:00 由爬虫自动更新

共提交 0

通过率 --%
时间上限 内存上限
2000 65536