liartie

Untitled

Oct 14th, 2022
976
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.47 KB | None | 0 0
  1.  
  2. #include <iostream>
  3. #include <algorithm>
  4. #include <iterator>
  5. #include <vector>
  6. #include <numeric>
  7.  
  8. using namespace std;
  9.  
  10. int main() {
  11.     int n;
  12.     cin>>n;
  13.     vector <int> v(n);
  14.     vector <int> nums(1000);
  15.     iota (nums.begin (), nums.end (), 0);
  16.     copy_n (istream_iterator <int> (cin), n, v.begin());
  17.     auto ans = remove_if (nums.begin (), nums.end (), [&] (int x) {return count (v.begin(), v.end(), x) != 0;});
  18.     cout << nums[0];
  19.     return 0;
  20. }
Advertisement
Add Comment
Please, Sign In to add comment