1 条题解
-
1
#include <cstdio> #include <cstring> #include <cmath> #include <cctype> #include <iostream> #include <algorithm> #include <map> #include <set> #include <vector> #include <string> #include <stack> #include <queue> typedef long long LL; using namespace std; int n, m; int a[100005], vis[100005]; int main() { //freopen("in.txt", "r", stdin); //freopen("out.txt", "w", stdout); scanf("%d %d", &n, &m); for (int i = 1; i <= m; i++){ scanf("%d", &a[i]); } for (int i = m; i >= 1; i--){ if(vis[a[i]]) continue; vis[a[i]] = 1; printf("%d ", a[i]); } for (int i = 1; i <= n; i++){ if(!vis[i]) printf("%d ", i); } printf("\n"); return 0; }
- 1
信息
- ID
- 524
- 时间
- 1000ms
- 内存
- 128MiB
- 难度
- 7
- 标签
- 递交数
- 41
- 已通过
- 11
- 上传者