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

zhx and contest

Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Others)
Total Submission(s): 1315    Accepted Submission(s): 480


Problem Description
As one of the most powerful brushes in the world, zhx usually takes part in all kinds of contests.
One day, zhx takes part in an contest. He found the contest very easy for him.
There are $n$ problems in the contest. He knows that he can solve the $i^{th}$ problem in $t_i$ units of time and he can get $v_i$ points.
As he is too powerful, the administrator is watching him. If he finishes the $i^{th}$ problem before time $l_i$, he will be considered to cheat.
zhx doesn't really want to solve all these boring problems. He only wants to get no less than $w$ points. You are supposed to tell him the minimal time he needs to spend while not being considered to cheat, or he is not able to get enough points.
Note that zhx can solve only one problem at the same time. And if he starts, he would keep working on it until it is solved. And then he submits his code in no time.
 

Input
Multiply test cases(less than $50$). Seek $EOF$ as the end of the file.
For each test, there are two integers $n$ and $w$ separated by a space. ($1 \leq n \leq 30$, $0 \leq w \leq {10}^{9}$)
Then come n lines which contain three integers $t_i, v_i, l_i$. ($1 \leq t_i,l_i \leq {10}^{5}, 1 \leq v_i \leq {10}^{9}$)
 

Output
For each test case, output a single line indicating the answer. If zhx is able to get enough points, output the minimal time it takes. Otherwise, output a single line saying "zhx is naive!" (Do not output quotation marks).
 

Sample Input
1 3 1 4 7 3 6 4 1 8 6 8 10 1 5 2 2 7 10 4 1 10 2 3
 

Sample Output
7 8 zhx is naive!
 

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-04-26 10:48:02, Gzip enabled