提交时间:2024-01-07 15:43:13

运行 ID: 230088

#include<bits/stdc++.h> using namespace std; int n,m; int ma[1000005] = {0}; int a[1000005] = {0}; int main() { ios::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); cin >> n >> m; int tmp; for(int i = 1;i <= n;i++) { ma[i] = 1; } for(int i = 0;i < m;i++) { cin >> a[i]; } for(int i = m - 1;i >= 0;i--) { if(ma[a[i]]) cout << a[i] << ' '; ma[a[i]] = 0; } for(int i = 1;i <= n;i++) { if(ma[i]) cout << i << ' '; ma[i] = 0; } return 114514; return 1919810; }