The municipal stage of the informatics Olympiad was held for students of the 7th and 11th grades. All students participated in the general competition. Each participant of the Olympiad could score from 0 to 400 points. According to the regulations on the Olympiad, the winner is the participant who scored the highest number of points, provided that he scored more than half of the possible points. There can be several winners if several people score this number of points; or maybe not at all, if no one gets more than half.
Write a program that is effective in terms of time and memory used (indicate the version of the programming language used, for example, Borland Pascal 7.0), which will determine the name and surname of the best participant who has not become the winner of the Olympiad. If several people follow the same point after the winners score, or if there are no winners, and there are several best participants (in this case, they are the required ones), then only the number of the required participants should be given. It is guaranteed that the required members (member) are available.
At the entrance to the program, first the number of participants in the Olympiad N (N <10,000) is given. Each of the following N lines contains the result of one of the participants in the Olympiad in the following format:
<Фамилия> <Имя> <класс> <баллы>
where <Фамилия>
is a string consisting of no more than 20 non-whitespace characters; <Имя>
is a string consisting of no more than 15 non-whitespace characters; <класс>
is a number from 7 to 11; <баллы>
is an integer from 0 to 400 points scored by the participant. <Фамилия>
and <Имя>, <Имя> и <класс>
, as well as <класс> и <баллы>
separated by a single space. Example input line:
Иванов Пётр 10 275
The program must display a space between the name and the name of the desired participant or their number. Sample output:
Кузнецов Иван Второй вариант выходных данных: 4
Actually a subject it is possible to use STL? http://pastebin.com/PGsPGF60