This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
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))
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |