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

  • one
    STL - part of the language, I do not see why its use may not be allowed. Although, of course, people are also sitting on the jury, so anything is possible. - VladD
  • It’s just that someone says, why the hell do you have to solve these problems if half of the ready-made tools are in there (in STL), but writing in pure C is also not a good option for me. - avengerweb
  • STL provides the simplest algorithms. If the olympiad problem is solved by applying one of them to the forehead - shame and disgrace to the compilers. - VladD
  • It remains to be explained by the verifier ... - avengerweb
  • @avengerweb can be used, but in C4 the points for using containers \ data structures are reduced. - phen0menon

1 answer 1

I read, it also became interesting. The reasons for the ban, running by the rules, I did not find, most likely you can. But it is better to clarify! Here is a link for feedback with representatives of the USE: http://ege.edu.ru/ru/feedback/ . Remember that there is a human factor here! One person can count, and the other not.

PS If you think to file an appeal for any reason, then know - sometimes you find a mistake in another task and the score becomes only less!