为啥 RE?
查看原帖
为啥 RE?
513329
徐晨轩✅楼主2021/10/24 20:36

代码:

#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;
}

2021/10/24 20:36
加载中...