Pagini recente » Cod sursa (job #1535226) | Cod sursa (job #2717668) | Cod sursa (job #381189) | Cod sursa (job #855749) | Cod sursa (job #1289488)
/// Craciun Catalin
/// Schi
#include <iostream>
#include <fstream>
#include <vector>
#include <forward_list>
#include <cstring>
using namespace std;
ifstream f("schi.in");
ofstream g("schi.out");
int n;
forward_list<int> clasament;
forward_list<int>::iterator iter;
char in[400005];
int pos, len;
int getint() {
int x=0;
while (in[pos] < '0' || in[pos] > '9') pos++;
while (in[pos] >= '0' && in[pos] <= '9') {
x = x*10 + (in[pos] - '0');
pos++;
}
return x;
}
int main() {
pos = 0;
f.read(in,400000);
len = strlen(in);
n = getint();
for (int i=1;i<=n;i++) {
int x = getint();
iter = clasament.begin();
if (x == 1)
clasament.push_front(i);
else {
advance(iter, x-2);
clasament.insert_after(iter, i);
}
}
for (iter = clasament.begin(); iter != clasament.end(); ++iter)
g<<*iter<<'\n';
f.close(); g.close();
return 0;
}