Advertisement
sherry_ahmos

Untitled

May 4th, 2022
143
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.85 KB | None | 0 0
  1. #include <iostream>
  2. #include <sstream>
  3. #include <cstdlib>
  4. #include <algorithm>
  5. #include <cmath>
  6. #include <iomanip>
  7. #include <numeric>
  8. #include <vector>
  9. #include <string>
  10. #include <set>
  11. #include <map>
  12.  
  13. using namespace std;
  14. #define ll long long
  15. void sherry()
  16. {
  17.     ios_base::sync_with_stdio(false), cin.tie(nullptr), cout.tie(nullptr);
  18. #ifndef ONLINE_JUDGE
  19.     freopen("input.txt", "r", stdin), freopen("output.txt", "w", stdout);
  20. #endif
  21. }
  22. bool comp(pair<int, int> a, pair<int, int> b)
  23. {
  24.     return a.second < b.second;
  25. }
  26. int main()
  27. {
  28.     sherry();
  29.     ll n;
  30.     cin >> n;
  31.     set<int> st;
  32.     for (ll i = 0; i < n; i++)
  33.     {
  34.         ll num;
  35.         cin >> num;
  36.         st.insert(num);
  37.     }
  38.  
  39.     if (*next(st.begin(), 1) > *next(st.begin(), 0))
  40.         cout << *next(st.begin(), 1);
  41.     else
  42.         cout << "NO";
  43.     return 0;
  44. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement