Cod sursa(job #3297735)

Utilizator andrei65tAndrei Popescu-Ilioniu andrei65t Data 23 mai 2025 17:16:52
Problema Schi Scor 70
Compilator cpp-64 Status done
Runda Arhiva de probleme Marime 0.52 kb
#include <fstream>
using namespace std;

ifstream fin("schi.in");
ofstream fout("schi.out");
int v[30001], a[30001];
int main() {
    int n;
    fin >> n;

    for (int i = 1; i <= n; i++)
        fin >> a[i];

    for (int i = n; i >= 1; i--) {
        int cnt = 0;
        for (int j = 1; j <= n; j++) {
            if (v[j] == 0) cnt++;
            if (cnt == a[i]) {
                v[j] = i;
                break;
            }
        }
    }

    for (int i = 1; i <= n; i++)
        fout << v[i] << '\n';

    return 0;
}