GMSTRE - Game Store


This day is a very special day, especially for all gamers around the world. The clock now is showing at 8 am and the queue in front of the game store is getting crazy. It is like a hundred of people standing in a line waiting for something big. Then what is that ? Yes, of course the people are going to buy the very new game, just released yesterday. It is the first first-person shooting (FPS) game with very incredible price. Brembo, one of the skillfull FPS gamers, of course he doesn't want to miss this. He also buys the game and then plays the game.

After one hour playing the games, Brembo feels that the game is very difficult, but sometimes is very easy. He doesn't feel good about that, and decided to replay the game from the beginning. However, now he wants to play the game in more balanced ways. He first plays the easy-difficulty levels and then go harder until the he reaches the hardest-difficulty level. Poor Brembo, he finds out that the levels are placed randomly and gets confused on choosing the levels.

You as his friends, called by Brembo to help him out. There are N levels in the game. Basically, in every level you are given the information about some specific elements. You will notice the bar under the map's levels that contain the information. First, is the number of Health Pack that will be placed in a level. Second, is the number of enemies in a level. And third, is the number of ammo available in a level. A level is said to be easier than another level if it follows these priority, it has more Health Pack, less enemies, and more ammo.

Now, you are about to analyze the situation based on the description above. Given the information of N levels, find the easiest and the hardest level based on the information. Since you are Brembo's best friend, you don't want to make him disappointed and you will help him.

Input

The first line of input is N, the number of levels in the game. (1 <= N <= 100)
The next N lines contain three integers separated by space Hi, Ei, Ai, represent the number of Health Pack, enemies, and ammo for i-th level. ( 1 <= Hi,Ei,Ai <= 10000)
It is guaranteed that every level has different information.

Output

The output contain two lines or one line if there is only one level.
First line : "Easiest is level a" (a for the level number)
Second Line : "Hardest is level b" (b for the level number)
Print them without quotes.

Example 1

Input:
4
3 2 3
3 4 1
1 4 5
2 2 2

Output:
Easiest is level 1
Hardest is level 3

Example 2

Input:
1
2 3 1

Output:
Easiest and Hardest is level 1

hide comments
utkarsh9: 2019-03-30 14:03:39

My 120th

ort: 2018-11-18 18:42:53

vector of tuples, custom sort, AC

vishalsingh17: 2018-10-31 11:10:10

no need to use lots of IF-ELSE just sort wisely :)

kajori: 2018-08-07 12:07:33

Test cast 19 in SPOJ ToolKit
4
1 0 0
2 0 0
3 0 0
4 0 0
Is giving incorrect answer
Easiest is level 27236209
Hardest is level 1

Re : It doesn't make any sense. In spoj toolkit, that was not my solution after all.

Last edit: 2018-08-09 10:57:41
mag1x_: 2018-05-24 08:47:25

check in order - health,enemies,ammo. sorting and then for loops with lots of if else ;)

Marcin: 2018-05-13 01:12:38

The description of the problem is misleading -- "A level is said to be easier than another level if it has more Health Pack, less enemies, and more ammo." clearly suggest that ALL three conditions must be met to consider a level easier, whereas the correct solution must check for health packs only first, in case of tie to check for enemies, and then for ammo as a last resort.

Re : Thanks. I have updated the description. -admin

Last edit: 2018-05-22 07:18:57
boemogensen: 2018-03-31 03:01:46

I think the right tag for this problem is greedy and not just the adhoc

Vipul Srivastava: 2018-03-28 17:32:38

@wisfaq I agree with you and it's quite confusing if you think about them before solving it

wisfaq: 2018-03-28 13:52:44

@Vipul Srivastava:
The output is:
Easiest is level 2
Hardest is level 1

I agree that several decision schemes could be used.

Last edit: 2018-03-28 15:15:22
nadstratosfer: 2018-03-26 09:36:52

Please use multiple cases in few large testfiles rather than separate testfile for each case in your future problems. My solution's runtime shows mostly the accumulated interpreter startup time.

Reply : Thanks for the suggestion :)

Last edit: 2018-03-28 04:24:42

Added by:Bayu_Laksana
Date:2018-03-25
Time limit:1s
Source limit:50000B
Memory limit:1536MB
Cluster: Cube (Intel G860)
Languages:All
Resource:Own Problem