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()
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
15 ms |
2 KB |
Output is correct |
2 |
Correct |
17 ms |
2 KB |
Output is correct |
3 |
Halted |
0 ms |
0 KB |
- |
4 |
Incorrect |
20 ms |
2 KB |
Output isn't correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
19 ms |
2 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
3 |
Correct |
16 ms |
2 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
18 ms |
3 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
20 ms |
3 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |