We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.

# Enter your code here. Read input from STDIN. Print output to STDOUTimportheapqimportsysfor_inrange(int(sys.stdin.readline())):t=list(map(int,sys.stdin.readline().split()))n=t[0]ifn==0:print(0)continuea=sorted(t[1:])heap={}forxina:ifxnotinheap:heap[x]=[]ifx-1inheapandlen(heap[x-1])>0:heapq.heappush(heap[x],heapq.heappop(heap[x-1])+1)else:heapq.heappush(heap[x],1)print(min(heap[x][0]forxinheapiflen(heap[x])))

## Team Formation

You are viewing a single comment's thread. Return to all comments →

Python3 solution