fork download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. const int MAX_LENGTH = 1000;
  5. const int MAX_VAL = 100000;
  6. int freq[MAX_VAL + MAX_VAL + 1];
  7.  
  8.  
  9. int main() {
  10. int n,val;
  11. cin >> n;
  12. for (int i = 1; i <= n; ++i) {
  13. cin >> val;
  14. int index = val + MAX_VAL;
  15. if (freq[index] == 1) {
  16. cout << val;
  17. return 0;
  18. }
  19. freq[index] = 1;
  20.  
  21. }
  22. cout << "NU";
  23. return 0;
  24. }
Success #stdin #stdout 0s 5316KB
stdin
4
1 0 7 0 
stdout
Standard output is empty