Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void solve()
- {
- int n;
- cin >> n;
- vector<int> v(n);
- for (auto &i : v)
- cin >> i;
- sort(v.begin(), v.end());
- for (int i = 0; i < n - 1; i++)
- {
- if (v[i + 1] != v[i] + 1)
- {
- cout << v[i] + 1 << endl;
- return;
- }
- }
- cout << v[0] + 1 << endl;
- }
Advertisement
Add Comment
Please, Sign In to add comment