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

Plants VS Zombies

Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)
Total Submission(s): 831    Accepted Submission(s): 363
Special Judge


Problem Description
Plants VS Zombies is a popular game in the TJU ACM Team now. However, RoBa is not very good at this game, so he wants you to write a program to help him.

We take a simplified version of this game. There are N rows in your backyard, and there are N zombies want to walk through your yard to eat your brain, and exactly one zombie in each row. The only method to defense the zombies is to plant ˇ°peashooterˇ± on the other side of the yard. However, you need T seconds to plant one peashooter. Once the peashooter is planted, it will begin to shoot at the zombies in its row. The zombies have different speed Vi and defense Di, which means that, the zombie in the i-th row need Vi second the walk though the yard, and the i-th zombie will be killed after Di second of shooting. Please note you can only plant one peashooter in each row.

Unfortunately, in some cases, for the zombies are too fast and/or too strong and/or your planting is too slow, you cannot kill all the zombies in time, so the zombies will eat your brains.
 

Input
There are several test cases in the input. The first line of each test case contains two integers N (1 <= N <= 100) and T, indicating the number of rows and the time for planting one peashooter. Then N lines follow, each of which contains two integers Vi and Di.
 

Output
Output one line for each test case. If you can kill all the zombies, output N numbers separated by a space, that is, a permutation of 1,2,ˇ­N, indicating the order of your planting. If you cannot defend your yard, output ˇ°The zombies eat your brains!ˇ± in one line.
 

Sample Input
3 10 20 10 40 10 30 10 3 10 20 10 40 11 30 10
 

Sample Output
1 3 2 The zombies eat your brains!
 

Hint

Hint: For the first case, you should plant a peashooter in the first row, then plant in the third row, then the second row.
Then all the zombies are killed just in time. For the second case, however, the zombie in second row is a little stronger, so you cannot kill all of them.
 

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-11-22 16:50:36, Gzip enabled