Pagini recente » alteproblemegogule | Cod sursa (job #2685074) | Cod sursa (job #1136548) | Cod sursa (job #2243457) | Cod sursa (job #2753772)
//#include<bits/stdc++.h>
#include<iostream>
#include<fstream>
#include<vector>
using namespace std;
ifstream f("schi.in");
ofstream g("schi.out");
int main(){
int i,n,pozitie,j,k;
f>>n;
vector<pair<int,int>> v;
pair<int,int> pereche;
pair<int,int> aux;
for(i=1;i<=n;++i){
f>>pozitie;
pereche=make_pair(pozitie,i);
if(pozitie==i){
v.push_back(pereche);
}
else{
v.push_back(pereche);
for(j=0;j<v.size();++j){
if(v[j].first==pozitie){
for(k=v.size()-2;k>=j;k--){
v[k].first=v[k].first+1;
aux=v[k+1];
v[k+1]=v[k];
v[k]=aux;
}
/*for(k=j+1;k<v.size();++k){
v[k].first=v[k].first+1;
}*/
break;
//v[j]=pair;
}
}
}
}
for(i=0;i<v.size();++i){
g<<v[i].second<<'\n';
}
return 0;
}