fork(1) download
  1. #include <iostream>
  2. #include <map>
  3. using namespace std;
  4.  
  5. int main()
  6. {
  7. map<int, int>hash;
  8. int n, m;
  9.  
  10. cin>>n; //Given range 1 to n
  11. cin>>m; // size of array
  12.  
  13. for(int i=1;i<=m;i++)
  14. {
  15. int x;
  16. cin>>x;
  17. hash[x] = 1;
  18. }
  19.  
  20. for(int i=1;i<=n;i++)
  21. {
  22. if(hash[i] == 0)
  23. cout<<i<<endl;
  24. }
  25. return 0;
  26. }
Success #stdin #stdout 0s 15240KB
stdin
12
9
1 2 3 4 6 7 8 9 12
stdout
5
10
11