ENG  RUSTimus Online Judge
Online Judge
Задачи
Авторы
Соревнования
О системе
Часто задаваемые вопросы
Новости сайта
Форум
Ссылки
Архив задач
Отправить на проверку
Состояние проверки
Руководство
Регистрация
Исправить данные
Рейтинг авторов
Текущее соревнование
Расписание
Прошедшие соревнования
Правила
вернуться в форум

Обсуждение задачи 1100. Таблица результатов

Hints and Solution for late people
Послано helloiamalive 8 ноя 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;
}