This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
def main():
n = int(raw_input())
s = map(int, raw_input().split())
m = int(raw_input())
s.sort()
if m <= n:
print s[m-1]
return
L = list(set(s))
c = len(L)
index = n
for i in range(n):
if c <= s[i]:
index = i
if index == n:
print c + m-(n+1)
return
diff = s[index] - c
if m - (n+1) > diff:
print s[index]
return
print c + m-(n+1)
return
main()
# | 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... |