#include<bits/stdc++.h>
using namespace std;
struct node {
int num;
int id;
};
list<node>a;
list<node>::iterator it = a.begin();
inline list<node>::iterator operator+(list<node>::iterator z, int x) {
list<node>::iterator i = z;
for (; x--; ++i);
return i;
}
inline bool operator ==(node a, node b) {
return a.num == b.num;
}
inline ostream& operator<<(ostream& out, node a) {
printf("%d", a.id);
return out;
}
int main() {
long long n;
cin >> n;
for (int i = 1; i <= n; i++) {
int x;
cin >> x;
a.push_back(node{x, i});
}
while (!a.empty())
{
it = a.begin();
for (it = a.begin(); it != a.end();it++)
{
if (!(*it == *(it + 1)))
{
cout << *it << " ";
a.erase(it);
continue;
}
cout << *it << " ";
it=a.erase(it);
if (!(*it == *(it + 1)))
{
}
else
{
while (((it + 1) != a.end() && it != a.end()) && *it == *(it + 1))
{
it++;
}
}
}
cout << endl;
}
}
本地两个样例可以正常运行,我下载的第一个测试点的数据也可以正常运行,为啥洛谷上RE?