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 = []
for i in range(n):
if s[i] not in L:
L.append(s[i])
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()
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
16 ms |
2 KB |
Output is correct |
2 |
Halted |
0 ms |
0 KB |
- |
3 |
Incorrect |
18 ms |
2 KB |
Output isn't correct |
4 |
Correct |
12 ms |
2 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Halted |
0 ms |
0 KB |
- |
2 |
Incorrect |
15 ms |
2 KB |
Output isn't correct |
3 |
Correct |
15 ms |
2 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
285 ms |
3 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Halted |
0 ms |
0 KB |
- |
2 |
Incorrect |
268 ms |
3 KB |
Output isn't correct |