ENG  RUSTimus Online Judge
Online Judge
Problems
Authors
Online contests
About Online Judge
Frequently asked questions
Site news
Webboard
Links
Problem set
Submit solution
Judge status
Guide
Register
Update your info
Authors ranklist
Current contest
Scheduled contests
Past contests
Rules
back to board

Discussion of Problem 1100. Final Standings

Hints and Solution for late people
Posted by helloiamalive 8 Nov 2025 15:43
Hint 1: The teams with same scores follow their original order, top to bottom.

Hint 2: You can implement stable sort by yourself.

Hint 3: M is given <=100.

Hint 4: Group all the teams with the same score together in a container.

Solution : Use an array of arrays, with size 101. You can add the input as it comes in the array with the index equal to its score. Output starting from the end, iterating over the array of arrays.

C++ Code:


#include <bits/stdc++.h>
using namespace std;

int main()
{
    int n;
    cin >> n;
    vector<vector<int>> v(101);
    for(int i =0;i<n;i++)
    {
        int a,b;
        cin >>a >> b;
        v[b].push_back(a);
    }
    for(int i =100;i >= 0;i--)
    {
        if((v[i].size()))
        {
            for(auto a:v[i])
            {
                cout << a << " " << i << "\n";
            }
        }
    }
    return 0;
}