fork download
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3.  
  4. int main() {
  5. int n,x; cin >> n;
  6. set<int> s;
  7. for(int i=0;i<n;i++){
  8. cin >> x;
  9. s.insert(x);
  10. }
  11. auto itr = s.begin();
  12. ++itr;
  13.  
  14. itr != s.end() ? cout << *(itr) : cout << "NO\n";
  15. return 0;
  16. }
Success #stdin #stdout 0s 5284KB
stdin
1 28
stdout
NO