← All problemsSign in

Sauron And His Army

Sauron is assembling an army to fight against the White Rider who is waging a war against him. Initially he had an army, containing N integers (id's of his warriors) . Now, General Saruman has to make M queries, to report about the war. Each query has one of the two types: - 1 l r p - Select all the numbers having indices between l and r (inclusive) that are divisible by p and divide them by p wh

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