How to solve this problem ( K burners and N gas cylinders)

Правка en1, от ocelo7, 2021-10-20 23:08:27

This question was asked in a coding test.

There are K burners in the lab and N gas cylinders for the fuel. Each cylinder has a different capacity. Now in each lab K students come to use the K burners. When lab starts all students connect their burner to a cylinder and start the burner. Students can change the cylinder in between themselves and with the cylinder which is idle, exchange takes negligible time. Now find the maximum time possible for which all K burners can burn simultaneously. Exchange can be done only in integral units not fractional. (you can exchange at 1 second or 2 seconds, not at 1.5 seconds).

Constraints: N < 1e5 K < N X[i] < 1e9

Sample Case:

N=3, K=2, X=[3,3,3] Answer = 4

N=5 K=3, X = [10,10,6,9,3] Answer = 12

Теги placement, test

История

 
 
 
 
Правки
 
 
  Rev. Язык Кто Когда Δ Комментарий
en1 Английский ocelo7 2021-10-20 23:08:27 819 Initial revision (published)