Cod sursa(job #3258015)

Utilizator KRISTY06Mateiu Ianis Cristian Vasile KRISTY06 Data 20 noiembrie 2024 15:52:08
Problema Schi Scor 60
Compilator cpp-64 Status done
Runda Arhiva de probleme Marime 0.81 kb
#include <bits/stdc++.h>
using namespace std;

ifstream fin("schi.in");
ofstream fout("schi.out");

int candidateRank[30001], superiorCandidatesCounter[30001];

set<pair<int, int>> ans;

int main() {
    int n;
    fin >> n;
    for (int i = 1; i <= n; ++i) {
        fin >> candidateRank[i];
        superiorCandidatesCounter[i] = candidateRank[i] - 1;
        for (int j = 1; j < i; ++j) {
            if (candidateRank[j] >= candidateRank[i]) {
                ++superiorCandidatesCounter[j];
                ++candidateRank[j];
            }
        }
    }
    for (int i = 1; i <= n; ++i) {
        ans.insert({superiorCandidatesCounter[i], i});
    }
    for (set<pair<int, int>>::iterator it = ans.begin(); it != ans.end(); ++it) {
        fout << it->second << '\n';
    }
    return 0;
}