← All problemsSign in

Raid the Village

There are N enemies numbered 1 to N each having power P[I] , i ranging from 1 to N who have raided the village . The ruler of village also has N allies numbered 1 to N each having power H[I] , I ranging from 1 to N . An allie ‘A’ can defeat an enemy ‘E’ if and only if power of ‘A’ is strictly greater than power of ‘E’ . Each Allie can defeat only one enemy. So the ruler wants to know that th

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