CodeChef admins went on shopping at a shopping mall.

There are N shops in the mall where the i^{th} shop has a capacity of A_i people. In other words, at any point in time, there can be at mostA_i number of people in the i^{th} shop.

There are X admins. Each admin wants to visit each of the N shops exactly once. It is known that an admin takes exactly one hour for shopping at any particular shop. Find the minimum time (in hours) in which all the admins can complete their shopping.

Note:

An admin can visit the shops in any order.

It is possible that at some point in time, an admin sits idle and does not visit any shop while others are shopping

EXPLANATION:

For each test case, we are given the number of shops N, the number of admins X and the maximum people that can shop at a particular store simultaneously.

Since each Admin must necessarily visit all the N shops once, so clearly the minimum time required in case of no restrictions is N.

When the maximum number of admins are limited for the shops, we first find the shop which allows for the minimum number of admins at the same time. This shop will tell us about the minimum time in case the shifts are more thanN otherwise the answer will remain N.

Please, tell where I am making the mistake.
Here is my code:

from math import ceil
for i in range(int(input())):
n_shop,x_admin= map(int,input().split())
#input capacity
capacity= list(map(int,input().split()))
if n_shop>=x_admin:
print(n_shop)
else:
min_capacity= capacity[0]
for cap in capacity:
if min_capacity>cap: min_capacity= cap
if min_capacity>=x_admin: print(n_shop)
else: print(ceil(x_admin/min_capacity))

according to your case there are 2 shops and 3 admins, letâ€™s name the shop A,B and admins with number 1,2,3.
Firstly admins 1,2 will shop in shop A and B in one hour now admin 1 will enter shop B and admin 3 will enter shop A in the second hour, finally admin 1 has completed its task by entering both shops, but admin 3 needs to visit shop B and admin 2 needs to visit shop 1. So that takes additional one hour, hence total hours are 3.

Hour Shop A Shop B
1 admin(1) admin(2)
2 admin(3) admin(1)
3 admin(2) admin(3)