i opens once the drill's accumulated charge reaches hardness[i]. The safes may be opened in any order.
The drill works like this:
- the charge starts at 0 and the charging rate starts at 1;
- every minute the charge grows by the current rate;
- as soon as the charge reaches (or exceeds) the hardness of the chosen safe, that safe opens, the charge drops back to 0 and the charging rate goes up by boost.
Return the smallest number of minutes needed to open all the safes.hardness=[5, 2, 7], boost=2 → 6
Open the hardness-2 safe first: 2 minutes at rate 1. The rate becomes 3, so the hardness-5 safe takes 2 more minutes. At rate 5 the hardness-7 safe takes 2 minutes. Total 6.
hardness=[4, 4], boost=1 → 6
The first safe takes 4 minutes at rate 1, the second takes 2 minutes at rate 2.
hardness=[5, 2, 7], boost=2
6
Run checks the first 3 tests in your browser. Submit checks all 168 tests on the server, hidden ones included.