CCC '08 S1 - It's Cold Here!

View as PDF

Submit solution

Points: 5
Time limit: 2.0s
Memory limit: 256M

Problem type
Canadian Computing Competition: 2008 Stage 1, Senior #1

Canada is cold in winter, but some parts are colder than others. Your task is very simple, you need to find the coldest city in Canada. So, when given a list of cities and their temperatures, you are to determine which city in the list has the lowest temperature and is thus the coldest.

Input

The input is a sequence of city names and temperature values. Temperatures are integer, possibly preceded with a "minus" sign. There is a single space between the city name and the temperature. No city name contains any whitespace and is always less than 256 characters in length. There is at least one city in the list, no more than 10\,000 cities, and the last city is always Waterloo. You may assume that the temperature is not less than -273 and not more than 200.

Output

You are to output the name of the coldest city on a single line with no whitespace before or after the name. You may assume that there will not be more than one city which is the coldest.

Sample Input

Saskatoon -20
Toronto -2
Winnipeg -40
Vancouver 8
Halifax 0
Montreal -4
Waterloo -3

Output for Sample Input

Winnipeg

Comments


  • 1
    maxcruickshanks  commented on Nov. 23, 2023, 11:24 p.m.

    Since the original data were weak, an additional 3 test cases were added, and all submissions were rejudged.


  • 3
    Mahdi_Jenhani  commented on Jan. 19, 2021, 9:42 p.m.

    can you tell me why do I always get a WA on my code, when i tried it myself it works just fine


    • 8
      tin_martin  commented on Dec. 19, 2021, 3:36 a.m.

      I had this issue too. I'm using Java and my problem was using == to compare values instead of using .equals() to fix the issue. Basically, the difference is in ==, you're comparing with the memory addresses but with .equals(), you are comparing values. Hopefully you can apply this to whatever language you use! :)


  • 9
    Dav_Did  commented on Jan. 11, 2021, 3:06 p.m.

    Aahhh, it's freezing here!


  • -28
    NickP  commented on Oct. 19, 2016, 9:12 a.m.

    This comment is hidden due to too much negative feedback. Show it anyway.


    • 38
      Kirito  commented on Oct. 19, 2016, 11:58 a.m.

      and the last city is always Waterloo