#include <cstdio>
#include <algorithm>
using namespace std;
int N, M, d=1;
int S[50050];
int main()
{
int i;
scanf("%d",&N);
for(i=1;i<=N;++i) scanf("%d",S+i);
scanf("%d",&M);
sort(S+1,S+N+1);
for(i=1;i<N;++i) if(S[i]!=S[i+1]) ++d;
for(i=1;i<=N;++i) if(d<=S[i]) break;
S[N+1]=0x7FFFFFFF;
printf("%d",min(S[i],d+M-N-1));
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
1280 KB |
Output isn't correct |
2 |
Incorrect |
0 ms |
1280 KB |
Output isn't correct |
3 |
Incorrect |
0 ms |
1280 KB |
Output isn't correct |
4 |
Incorrect |
0 ms |
1280 KB |
Output isn't correct |
5 |
Incorrect |
0 ms |
1280 KB |
Output isn't correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
1280 KB |
Output is correct |
2 |
Correct |
0 ms |
1280 KB |
Output is correct |
3 |
Correct |
0 ms |
1280 KB |
Output is correct |
4 |
Correct |
0 ms |
1280 KB |
Output is correct |
5 |
Correct |
0 ms |
1280 KB |
Output is correct |
6 |
Correct |
0 ms |
1280 KB |
Output is correct |
7 |
Correct |
0 ms |
1280 KB |
Output is correct |
8 |
Correct |
0 ms |
1280 KB |
Output is correct |
9 |
Correct |
0 ms |
1280 KB |
Output is correct |
10 |
Correct |
0 ms |
1280 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
1280 KB |
Output is correct |
2 |
Incorrect |
13 ms |
1280 KB |
Output isn't correct |
3 |
Incorrect |
13 ms |
1280 KB |
Output isn't correct |
4 |
Correct |
12 ms |
1280 KB |
Output is correct |
5 |
Correct |
6 ms |
1280 KB |
Output is correct |
6 |
Correct |
1 ms |
1280 KB |
Output is correct |
7 |
Incorrect |
5 ms |
1280 KB |
Output isn't correct |
8 |
Correct |
10 ms |
1280 KB |
Output is correct |
9 |
Correct |
9 ms |
1280 KB |
Output is correct |
10 |
Correct |
3 ms |
1280 KB |
Output is correct |
11 |
Correct |
1 ms |
1280 KB |
Output is correct |
12 |
Incorrect |
10 ms |
1280 KB |
Output isn't correct |
13 |
Incorrect |
0 ms |
1280 KB |
Output isn't correct |
14 |
Incorrect |
14 ms |
1280 KB |
Output isn't correct |
15 |
Correct |
7 ms |
1280 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
5 ms |
1280 KB |
Output is correct |
2 |
Correct |
4 ms |
1280 KB |
Output is correct |
3 |
Correct |
13 ms |
1280 KB |
Output is correct |
4 |
Correct |
1 ms |
1280 KB |
Output is correct |
5 |
Correct |
13 ms |
1280 KB |
Output is correct |
6 |
Correct |
0 ms |
1280 KB |
Output is correct |
7 |
Correct |
9 ms |
1280 KB |
Output is correct |
8 |
Correct |
9 ms |
1280 KB |
Output is correct |
9 |
Correct |
10 ms |
1280 KB |
Output is correct |
10 |
Correct |
0 ms |
1280 KB |
Output is correct |
11 |
Correct |
5 ms |
1280 KB |
Output is correct |
12 |
Correct |
14 ms |
1280 KB |
Output is correct |
13 |
Correct |
3 ms |
1280 KB |
Output is correct |
14 |
Correct |
12 ms |
1280 KB |
Output is correct |
15 |
Correct |
0 ms |
1280 KB |
Output is correct |