N = int(input())
S = list(set(map(int, input().split())))
M = int(input())
diff = len(S)
if diff in S:
print(diff)
else:
S.append(0x7FFFFFFF) # Max
S.append(diff) # Now
S.sort()
inserted = S.index(diff) # N+1
End = S[inserted + 1]
print(min(M - (N + 1 - diff), End))
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
26 ms |
18228 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
25 ms |
18228 KB |
Output is correct |
2 |
Correct |
26 ms |
18236 KB |
Output is correct |
3 |
Correct |
26 ms |
18236 KB |
Output is correct |
4 |
Correct |
31 ms |
18244 KB |
Output is correct |
5 |
Correct |
25 ms |
18228 KB |
Output is correct |
6 |
Correct |
26 ms |
18232 KB |
Output is correct |
7 |
Correct |
27 ms |
18228 KB |
Output is correct |
8 |
Correct |
25 ms |
18228 KB |
Output is correct |
9 |
Correct |
25 ms |
18252 KB |
Output is correct |
10 |
Correct |
26 ms |
18228 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
42 ms |
26996 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
33 ms |
21816 KB |
Output is correct |
2 |
Correct |
25 ms |
18236 KB |
Output is correct |
3 |
Correct |
31 ms |
19760 KB |
Output is correct |
4 |
Correct |
34 ms |
22832 KB |
Output is correct |
5 |
Correct |
40 ms |
25908 KB |
Output is correct |
6 |
Correct |
32 ms |
21812 KB |
Output is correct |
7 |
Correct |
29 ms |
19248 KB |
Output is correct |
8 |
Correct |
29 ms |
20280 KB |
Output is correct |
9 |
Correct |
29 ms |
19504 KB |
Output is correct |
10 |
Correct |
45 ms |
27204 KB |
Output is correct |
11 |
Correct |
31 ms |
21556 KB |
Output is correct |
12 |
Correct |
42 ms |
26488 KB |
Output is correct |
13 |
Correct |
32 ms |
21292 KB |
Output is correct |
14 |
Correct |
44 ms |
26996 KB |
Output is correct |
15 |
Correct |
35 ms |
23600 KB |
Output is correct |