Cod sursa(job #3289387)

Utilizator Cezar2009Cezar Mihai Titihazan Cezar2009 Data 26 martie 2025 18:23:09
Problema Schi Scor 100
Compilator cpp-64 Status done
Runda Arhiva de probleme Marime 0.84 kb

//#pragma GCC optimize ("Ofast")
//#pragma GCC optimize ("fast-math")
//#pragma GCC optimize ("unroll-loops")
//#define _USE_MATH_DEFINES
#include <iostream>
#include <fstream>
#include <vector>
//#include <cstring>
//#include <cmath>
//#include <bitset>
//#include <queue>
//#include <utility>
//#include <algorithm>
//#include <string>
//#include <map>
//#include <climits>
//#include <iomanip>
using namespace std;

ifstream fin("schi.in");
ofstream fout("schi.out");

int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);

	int n, i, pos;
	vector <int> v;

	fin >> n;
	for (i = 1; i <= n; ++i)
	{
		fin >> pos;

		if (pos == i)
		{
			v.push_back(pos);
		}
		else
		{
			auto it = v.begin() + pos - 1;
			v.insert(it, i);
		}
	}

	for (i = 0; i < n; ++i)
		fout << v[i] << "\n";

	return 0;
}