fork download
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3.  
  4. #define ll long long
  5. #define FOR(i, k, n) for (int i = (k), _n = (n); i <= _n; i++)
  6. #define FOV(i, k, n) for (int i = (n), _n = (k); i >= _n; i--)
  7. #define REP(i, n) FOR(i, 1, n)
  8. #define REV(i, n) FOV(i, 1, n)
  9.  
  10. const int MAXN = 1e6 + 28;
  11.  
  12. int cnt[MAXN], a[MAXN];
  13. int n;
  14.  
  15. int main() {
  16. ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
  17.  
  18. if (fopen("input.txt", "r")) {
  19. freopen("input.txt", "r", stdin);
  20. freopen("output.txt", "w", stdout);
  21. }
  22.  
  23. cin >> n;
  24. REP(i, n) cin >> a[i], cnt[a[i]]++;
  25.  
  26. REP(i, n) {
  27. if (cnt[a[i]] % 2 != 0) {
  28. cout << a[i];
  29. return 0;
  30. }
  31. }
  32. }
Success #stdin #stdout 0.01s 5324KB
stdin
Standard input is empty
stdout
Standard output is empty