#include <stdio.h>
#include <algorithm>
#define INF 0x7fffffff
using namespace std;
int N, S[50001], M, K, Ans=INF;
int main(void) {
int i;
scanf("%d",&N);
for(i=1 ; i<=N ; i++) scanf("%d",&S[i]);
sort(S+1,S+N+1);
scanf("%d",&M);
S[0]=-INF;
for(i=1 ; i<=N ; i++)
if(S[i]!=S[i-1]) K++;
Ans=K+M-N-1;
for(i=1 ; i<=N ; i++) if(K<=S[i] && S[i]<=K+M-N-1 && Ans>S[i]) Ans=S[i];
printf("%d",Ans);
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
1276 KB |
Output isn't correct |
2 |
Incorrect |
0 ms |
1276 KB |
Output isn't correct |
3 |
Incorrect |
0 ms |
1276 KB |
Output isn't correct |
4 |
Incorrect |
0 ms |
1276 KB |
Output isn't correct |
5 |
Incorrect |
0 ms |
1276 KB |
Output isn't correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
1276 KB |
Output is correct |
2 |
Correct |
0 ms |
1276 KB |
Output is correct |
3 |
Correct |
0 ms |
1276 KB |
Output is correct |
4 |
Correct |
0 ms |
1276 KB |
Output is correct |
5 |
Correct |
0 ms |
1276 KB |
Output is correct |
6 |
Correct |
0 ms |
1276 KB |
Output is correct |
7 |
Correct |
0 ms |
1276 KB |
Output is correct |
8 |
Correct |
0 ms |
1276 KB |
Output is correct |
9 |
Correct |
0 ms |
1276 KB |
Output is correct |
10 |
Correct |
0 ms |
1276 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
15 ms |
1276 KB |
Output isn't correct |
2 |
Incorrect |
0 ms |
1276 KB |
Output isn't correct |
3 |
Correct |
0 ms |
1276 KB |
Output is correct |
4 |
Correct |
0 ms |
1276 KB |
Output is correct |
5 |
Incorrect |
3 ms |
1276 KB |
Output isn't correct |
6 |
Incorrect |
8 ms |
1276 KB |
Output isn't correct |
7 |
Correct |
0 ms |
1276 KB |
Output is correct |
8 |
Correct |
10 ms |
1276 KB |
Output is correct |
9 |
Incorrect |
7 ms |
1276 KB |
Output isn't correct |
10 |
Correct |
12 ms |
1276 KB |
Output is correct |
11 |
Correct |
0 ms |
1276 KB |
Output is correct |
12 |
Incorrect |
13 ms |
1276 KB |
Output isn't correct |
13 |
Correct |
0 ms |
1276 KB |
Output is correct |
14 |
Correct |
13 ms |
1276 KB |
Output is correct |
15 |
Correct |
0 ms |
1276 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
1276 KB |
Output is correct |
2 |
Correct |
0 ms |
1276 KB |
Output is correct |
3 |
Correct |
13 ms |
1276 KB |
Output is correct |
4 |
Correct |
10 ms |
1276 KB |
Output is correct |
5 |
Correct |
11 ms |
1276 KB |
Output is correct |
6 |
Correct |
0 ms |
1276 KB |
Output is correct |
7 |
Correct |
2 ms |
1276 KB |
Output is correct |
8 |
Correct |
2 ms |
1276 KB |
Output is correct |
9 |
Correct |
14 ms |
1276 KB |
Output is correct |
10 |
Correct |
7 ms |
1276 KB |
Output is correct |
11 |
Correct |
12 ms |
1276 KB |
Output is correct |
12 |
Correct |
14 ms |
1276 KB |
Output is correct |
13 |
Correct |
14 ms |
1276 KB |
Output is correct |
14 |
Correct |
10 ms |
1276 KB |
Output is correct |
15 |
Correct |
0 ms |
1276 KB |
Output is correct |