Advertisement
Mirbek

B - Who is missing? (Atcoder)

Jan 28th, 2022
941
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <bits/stdc++.h>
  2.  
  3. using namespace std;
  4.  
  5. const int N = 1e5 + 3;
  6.  
  7. int cnt[N];
  8.  
  9. int main(){
  10.     int n;
  11.     cin >> n;
  12.  
  13.     for (int i = 1; i <= 4 * n - 1; i++) {
  14.         int x;
  15.         cin >> x;
  16.         cnt[x]++;
  17.     }
  18.  
  19.     for (int i = 1; i <= n; i++) {
  20.         if (cnt[i] == 3) {
  21.             cout << i << endl;
  22.             return 0;
  23.         }
  24.     }
  25. }
  26.  
Advertisement
Advertisement
Advertisement
RAW Paste Data Copied
Advertisement