Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <sstream>
- #include <cstdlib>
- #include <algorithm>
- #include <cmath>
- #include <iomanip>
- #include <numeric>
- #include <vector>
- #include <string>
- #include <set>
- #include <map>
- using namespace std;
- #define ll long long
- void sherry()
- {
- ios_base::sync_with_stdio(false), cin.tie(nullptr), cout.tie(nullptr);
- #ifndef ONLINE_JUDGE
- freopen("input.txt", "r", stdin), freopen("output.txt", "w", stdout);
- #endif
- }
- bool comp(pair<int, int> a, pair<int, int> b)
- {
- return a.second < b.second;
- }
- int main()
- {
- sherry();
- ll n;
- cin >> n;
- set<int> st;
- for (ll i = 0; i < n; i++)
- {
- ll num;
- cin >> num;
- st.insert(num);
- }
- if (*next(st.begin(), 1) > *next(st.begin(), 0))
- cout << *next(st.begin(), 1);
- else
- cout << "NO";
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement