#include <bits/stdc++.h>
using namespace std;
bool a[1145141] = {};
int main() {
int n, m, sum = 0;
cin >> n;
for (int i = 1; i <= n; i++) {
cin >> m;
if (a[m] != 1) {
a[m] = 1;
sum++;
}
}
cout << sum << endl;
for (int j = 1; j <= 1145141; j++) {
if (a[j])
cout << j << " ";
}
return 0;
}
共 2 条回复
感谢站长大大qwq
bool a[1145141] = {};
数组的下标从0开始的