代码:
#include <bits/stdc++.h>
using namespace std;
list<pair<int,int>>l;
// pair < first: num, second: index >
int n,t,now;
int main()
{
// freopen("T4.in","r",stdin);
ios::sync_with_stdio(false);
cin.tie(0);cout.tie(0);
cin >> n;
for(int i=1;i<=n;i++)
{
cin >> t;
l.push_back(make_pair(t,i));
}
while(!l.empty())
{
// cerr << '#' << endl;
now=-1;
for(auto it=l.begin();it!=l.end();it++)
if((*it).first!=now)// new block
{
auto tmpit=it;
cout << (*it).second << " ";
l.erase(tmpit);
now=(*it).first;
// cerr << "(stderr) " << l.size() << endl;
// cerr << "(stderr) " << now << endl;
// cerr << "(stderr) " << *it << endl;
}
cout << endl;
}
return 0;
}