Cod sursa(job #2749424)

Utilizator cristivasileVasile George-Cristian cristivasile Data 6 mai 2021 17:36:48
Problema Schi Scor 55
Compilator cpp-64 Status done
Runda Arhiva de probleme Marime 0.52 kb
#include <fstream>
#include <list>

using namespace std;

ifstream f("schi.in");
ofstream g("schi.out");

list <int> schiori;

int aux, n, x;
list<int>::iterator it;

int main()
{
    f >> n;
    for (int i = 1; i <= n; i++) {
        f >> x;

        it = schiori.begin();
        aux = 0;

        while (aux < x-1) {
            aux++;
            it++;
        }

        schiori.insert(it, i);
    }

    for (auto it = schiori.begin(); it != schiori.end(); it++)
        g << *it << "\n";
}