F - Cans and Openers Editorial by Kiri8128


Consider fixing the number of times to use the can openers. It is optimal to use can openers in descending order of \(X_i\)’s. It is also optimal to select target cans in descending order of satisfaction. You can simulate the process of using the can opener one by one by managing the available cans with balanced binary tree etc.

AC Code (PyPy3)

posted:
last update: