#include <cstdio>
#include <algorithm>
using namespace std;
int arr[50000];
int main() {
int N, i, differ = 1, sup = 1000001, ord, tst;
scanf("%d", &N);
for (i=0; i<N; ++i) {
scanf("%d", arr+i);
}
stable_sort(arr, arr+N);
for (i=1; i<N; ++i) {
differ += (arr[i] != arr[i - 1]);
}
for (i=0; i<N; ++i) {
if (arr[i] >= differ) {
sup = arr[i];
break;
}
}
scanf("%d", &ord);
tst = ord - (N + 1) + differ;
if (tst >= sup) tst = sup;
printf("%d\n", tst);
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
1408 KB |
Output isn't correct |
2 |
Incorrect |
0 ms |
1408 KB |
Output isn't correct |
3 |
Incorrect |
0 ms |
1408 KB |
Output isn't correct |
4 |
Incorrect |
0 ms |
1408 KB |
Output isn't correct |
5 |
Incorrect |
0 ms |
1408 KB |
Output isn't correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
1408 KB |
Output is correct |
2 |
Correct |
0 ms |
1408 KB |
Output is correct |
3 |
Correct |
0 ms |
1408 KB |
Output is correct |
4 |
Correct |
0 ms |
1408 KB |
Output is correct |
5 |
Correct |
0 ms |
1408 KB |
Output is correct |
6 |
Correct |
0 ms |
1408 KB |
Output is correct |
7 |
Correct |
0 ms |
1408 KB |
Output is correct |
8 |
Correct |
0 ms |
1408 KB |
Output is correct |
9 |
Correct |
0 ms |
1408 KB |
Output is correct |
10 |
Correct |
0 ms |
1408 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
14 ms |
1600 KB |
Output is correct |
2 |
Correct |
0 ms |
1408 KB |
Output is correct |
3 |
Incorrect |
8 ms |
1600 KB |
Output isn't correct |
4 |
Incorrect |
2 ms |
1408 KB |
Output isn't correct |
5 |
Correct |
10 ms |
1600 KB |
Output is correct |
6 |
Correct |
4 ms |
1556 KB |
Output is correct |
7 |
Correct |
6 ms |
1408 KB |
Output is correct |
8 |
Correct |
6 ms |
1564 KB |
Output is correct |
9 |
Correct |
0 ms |
1408 KB |
Output is correct |
10 |
Correct |
10 ms |
1600 KB |
Output is correct |
11 |
Incorrect |
14 ms |
1600 KB |
Output isn't correct |
12 |
Correct |
2 ms |
1408 KB |
Output is correct |
13 |
Incorrect |
15 ms |
1600 KB |
Output isn't correct |
14 |
Incorrect |
9 ms |
1592 KB |
Output isn't correct |
15 |
Incorrect |
11 ms |
1600 KB |
Output isn't correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
3 ms |
1600 KB |
Output isn't correct |
2 |
Incorrect |
6 ms |
1408 KB |
Output isn't correct |
3 |
Incorrect |
8 ms |
1556 KB |
Output isn't correct |
4 |
Correct |
0 ms |
1408 KB |
Output is correct |
5 |
Incorrect |
11 ms |
1600 KB |
Output isn't correct |
6 |
Correct |
15 ms |
1600 KB |
Output is correct |
7 |
Incorrect |
13 ms |
1600 KB |
Output isn't correct |
8 |
Correct |
3 ms |
1408 KB |
Output is correct |
9 |
Correct |
10 ms |
1600 KB |
Output is correct |
10 |
Incorrect |
3 ms |
1408 KB |
Output isn't correct |
11 |
Incorrect |
10 ms |
1592 KB |
Output isn't correct |
12 |
Incorrect |
10 ms |
1600 KB |
Output isn't correct |
13 |
Correct |
11 ms |
1600 KB |
Output is correct |
14 |
Incorrect |
3 ms |
1564 KB |
Output isn't correct |
15 |
Correct |
0 ms |
1408 KB |
Output is correct |