Cod sursa(job #786007)

Utilizator valentina506Moraru Valentina valentina506 Data 10 septembrie 2012 12:49:51
Problema Schi Scor 75
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.38 kb
#include<fstream>
using namespace std;
int n,i,j,x,poz[30001],l,x1,x2;
int main()
{
	ifstream f("schi.in");
	ofstream g("schi.out");
	
	f>>n;
	for(l=1;l<=n;++l)
	{
		f>>x;
		x1=poz[x];
		poz[x]=l;
		if(x1!=0)
		{
			for(i=x+1;i<=n&&x1;++i)
			{
				x2=poz[i];
				poz[i]=x1;
				x1=x2;
			}
				
		}
		
	}
	for(i=1;i<=n;++i)
		g<<poz[i]<<"\n";
	return 0;
}