← All problemsSign in

Story of Berland

In West of Berland, there were two kings A and B who had conflicts between them. So, on a particular date they used battle fight to solve the dispute. Both of them had different armies. Each soldier of the respective army had strength Si. Somehow, B found out the respective strength of each soldier of A's army before some battles.After this he was desperate to defeat A. In order to defeat A, he

HINT LADDERno hints yet
L1 Observation
L2 Technique
L3 Approach
L4 Pseudo-code
🔒
L5 Full solution
L5 unlocks only if you insist twice
solution.cppC++17

CodeSearch Tutor

Hints, not spoilers — it won’t hand over the full solution unless you insist.

voice by Sarvam AI

Sign in to chat with the tutor and save your progress.

Sign in to start