Let's Go to Jinju! (Hard)
Time limit3sMemory limit16 MB
Given N transport options with destinations and fares, print the fare to jinju and how many options cost more than that fare.
- Level
Easy2 of 10
- Topics
- Implementation, String
- Solved
- No attempts yet
Problem
This problem is the same as "Let's Go to Jinju! (Easy)" except for the range of the input numbers. Be sure to check the language and memory limits.
Boseon, a Gyeongsang National University graduate worn out by life in Seoul, misses the college years and wants to visit Jinju, where the university is. So Boseon went straight to the Seoul bus terminal to make a day trip to Jinju.
The Seoul terminal has transportation options. Each option has a destination and a fare, and all destinations are distinct. The destinations always include jinju, which is the option going to Jinju.
With prices rising, Boseon wants to know the fare to Jinju and how many options cost more than that. Boseon is too exhausted to check all options, so Boseon asks us to find this information.
Now, help Boseon out.
Input
The first line contains , the number of transportation options at the Seoul terminal. ()
From the second line, the next lines each contain and , separated by a space. is the destination of the -th option, a string of 1 to 15 lowercase English letters. Exactly one has jinju, meaning the -th option goes to Jinju. is the fare of the -th option. (; )
All numbers in the input are integers.
Output
The first line prints the fare of the option to Jinju.
The second line prints the number of options that cost more than the option to Jinju.
Hint
The input is very large, so use fast input and output methods.