You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
|
|
#include <bits/stdc++.h>
|
|
|
|
|
|
|
|
|
|
using namespace std;
|
|
|
|
|
const int N = 200010;
|
|
|
|
|
int n, cnt;
|
|
|
|
|
|
|
|
|
|
struct Node {
|
|
|
|
|
int id, value;
|
|
|
|
|
};
|
|
|
|
|
vector<Node> a;
|
|
|
|
|
//70分,不能AC
|
|
|
|
|
int main() {
|
|
|
|
|
scanf("%d", &n);
|
|
|
|
|
for (int i = 1; i <= n; i++) {
|
|
|
|
|
int x;
|
|
|
|
|
scanf("%d", &x);
|
|
|
|
|
a.push_back({i, x});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
while (cnt < n) {
|
|
|
|
|
int flag = 2;
|
|
|
|
|
//枚举vector中每个数字,之所以采用迭代器,是因为循环过程中要删除
|
|
|
|
|
for (auto it = a.begin(); it != a.end();) {
|
|
|
|
|
Node x = *it;
|
|
|
|
|
if (x.value != flag) {
|
|
|
|
|
flag = x.value;
|
|
|
|
|
printf("%d ", x.id);
|
|
|
|
|
cnt++;
|
|
|
|
|
a.erase(it);
|
|
|
|
|
} else
|
|
|
|
|
++it;
|
|
|
|
|
}
|
|
|
|
|
printf("\n");
|
|
|
|
|
}
|
|
|
|
|
return 0;
|
|
|
|
|
}
|