Question: use c++ do not use library function use structure A young programmer wrote his first testing system. He was so happy it compiled that he
use c++
do not use library function
use structure

A young programmer wrote his first testing system. He was so happy it compiled that he invited his school friends to his own contest. But at the end of the tour it turned out that the system can't sort the teams in the results table properly. Help the programmer to write the correct implementation of the sorting. The teams should be sorted by the next criteria: 1) By the quantity of solved tasks in descending order 2) When the quantities of solved tasks are equal by the penalty time in ascending order 3) When both quantities of solved tasks and penalty times are equal - by the indices of teams in ascending order. You should use structures while completing this task. Input: The first line contains a natural n (1sns 105) - the quantity of teams participating in the contest. The next n lines contain two numbers S - the quantity of solved tasks (0 s Ss 100) and the penalty time T (1 s T s 106) of the ith team. Output: n numbers - the indices of teams in sorted order. Example: Input Output 5 5 2 1 3 4 3 50 5 720 1 7 08 8 500
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
