F.A.Q
Hand In Hand
Online Acmers
Problem Archive
Realtime Judge Status
Authors Ranklist
 
     C/C++/Java Exams     
ACM Steps
Go to Job
Contest LiveCast
ICPC@China
Best Coder beta
VIP | STD Contests
    DIY | Web-DIY beta
Author ID 
Password 
 Register new ID

Hinanai Tenshi¡¯s peach garden

Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)
Total Submission(s): 625    Accepted Submission(s): 183


Problem Description
Hinanai Tenshi is managing a peach garden in Bhavagra. Due to the careful watch of Tenshi, the peach garden becomes a great view of Bhavagra. Once a famous person whose ear is pretty big said when visiting the garden: ¡°This is peach garden?¡±

Another harvest season has come, Tenshi wants to move all the peaches to one point, so Tenshi sent her sidekick, Nagae Iku, to do this mission. However, Iku was only able to move all peaches to N points before she was sent to other missions¡­The remaining work can only be done by Tenshi herself.

Now Iku has moved the peaches to N points, the ith point is (xi, 0), which has pi peaches on it. Moving one peach from one point to another point costs the distance between these two points, two peaches is double the cost and etc. Tenshi wants to move as many peaches to one point as possible without costing too much, so Tenshi wants to know how many peaches can she move to one point without total costing over K.
 

Input
Multiple test cases (no more than 20), for each case:
The first line contains two integers N and K (0<N<=10^4, 0<=K<=10^18).
Following N lines, each line contains two integers xi and pi (0<=xi<10^9, 0<pi<10^4).
Input terminates with EOF.
 

Output
For each cast output one integer, representing the number of peaches she can move to one place at most.
 

Sample Input
3 1 0 1 1 1 2 1
 

Sample Output
2
 

Author
temperlsyer
 

Source
 

Statistic | Submit | Discuss | Note
Hangzhou Dianzi University Online Judge 3.0
Copyright © 2005-2024 HDU ACM Team. All Rights Reserved.
Designer & Developer : Wang Rongtao LinLe GaoJie GanLu
Total 0.000000(s) query 1, Server time : 2024-05-09 09:40:13, Gzip enabled