Codejam Qualification Round 2022. Task 3
Python Only
T=int(input())
for t in range(T):
N=int(input())
S=input()
k=N
if k>4:
S=sorted([int(s) for s in S.split()])[::-1]
k=N=min([N,S[0]])
for i in range(N):
if S[i] < N-i:
k-=1
print('Case #{}: {}'.format(t+1,k))
No comments:
Post a Comment