N = int(input())
L_S = list(map(int, input().split()))
M = int(input())
if M <= len(L_S):
print(L_S[M - 1])
else:
S = list(set(L_S))
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 |
Runtime error |
25 ms |
20028 KB |
Execution failed because the return code was nonzero |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
21 ms |
19260 KB |
Execution failed because the return code was nonzero |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
23 ms |
21300 KB |
Execution failed because the return code was nonzero |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
43 ms |
30544 KB |
Execution failed because the return code was nonzero |
2 |
Halted |
0 ms |
0 KB |
- |