Cod sursa(job #3338876)

Utilizator bulatalexandrinaAlexandrina Bulat bulatalexandrina Data 5 februarie 2026 12:51:27
Problema Schi Scor 45
Compilator cpp-64 Status done
Runda Arhiva de probleme Marime 0.5 kb
#include<bits/stdc++.h>
using namespace std;
long long n, A[3001], i, x, p, j;

int main ()
{	ifstream f("schi.in");
	ofstream g("schi.out");
	f >> n;
	for(i = 1; i <= n; i++)
		f >> A[i]; 
	p = 1;
	while(p <= n)
	      { for(i = 1; i <= n; i++)
			if(A[i] == p ) x = i;

		for(j = 1; j <= x - 1; j++)
		     if(A[j] >= p ) A[j]++;
		p++; }
	int ok = 1;
	while(ok <= n)
	      { for(i = 1;i <= n; i++)
		if(A[i]==ok)   	g << i <<"\n";
				ok++; }
	f.close();
	g.close();
	return 0;}