This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <iostream>
using namespace std;
int arr[2000002], s, series[50001];
int main() {
int n, m, a, i;
cin >> n;
for(i = 0; i < n; i++) {
cin >> a;
a += 1000000;
series[i] = a;
if(!arr[a])
s++;
arr[a]++;
}
cin >> m;
if(m < n) {
cout << series[m - 1];
return 0;
}
for(i = n; i < m; i++) {
if(arr[s + 1000000]) {
break;
}
s++;
}
cout << s - (i == m);
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |