Cod sursa(job #971212)

Utilizator monica11Szekely Monica monica11 Data 8 iulie 2013 18:57:15
Problema Schi Scor 25
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.5 kb
#include<fstream>
using namespace std;
ifstream f("schi.in");
ofstream g("schi.out");
int a[30000],n,x,i,j,max1,poz[30000];
int main()
{
	f>>n;
	f>>x;
    a[1]=1;
    max1=1;
    for(i=2;i<=n;i++)
    {
        f>>x;
        a[i]=x;
        if(x<=max1)
            for(j=1;j<i;j++)
                if(a[j]>=x)
                    a[j]++;
        if(max1<x)
            max1=x;
    }
    for(i=1;i<=n;i++)
        poz[a[i]]=i;
    for(i=1;i<=n;i++)
        g<<poz[i]<<"\n";
    return 0;
}