Advertisement
Guest User

Untitled

a guest
Oct 16th, 2018
63
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.54 KB | None | 0 0
  1. #include <iostream>;
  2. #include <vector>;
  3. using namespace std;
  4. int main() {
  5. ios_base::sync_with_stdio(0);
  6. freopen ("tickets.in", "r", stdin);
  7. freopen ("tickets.out", "w", stdout);
  8.  
  9. int n,m, t, count=0;
  10.  
  11. cin>>n>>m;
  12.  
  13. int a[n];
  14.  
  15. for(int i = 1; i <=n; i++) a[i] = 0;
  16.  
  17. for(int i = 1; i <= m; i++){
  18. cin>>t;
  19. a[t]++;
  20. }
  21.  
  22. for(int i = 1; i <=n; i++){
  23.  
  24. if(a[i] > 1) count++;
  25.  
  26. }
  27. cout<<count<<"\n";
  28.  
  29. if(count == 0) return 0;
  30.  
  31. for(int i = 1; i <= n; i++){
  32.  
  33. if(a[i] > 1) cout<<i<<" ";
  34.  
  35. }
  36. return 0;
  37. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement