← All problemsSign in

Evil Book

CodeChefRating 2490Open on judge ↗

Chef Ciel got enormous cooking power from the Evil Book. Instead, Ciel must devote 666 magical power to the Evil Book. Other than Ciel, there are N chefs in the world. The i-th chef has Ci cooking power and Mi magical power. Ciel may get Mi magical power by defeating the i-th chef in a cooking battle, which needs Ci effort. After that, the i-th chef's magical power Mi becomes 0. The Evil B

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