War II
CodeChefOpen on judge ↗
Chefland has kingdoms each kingdom is identified by 1, 2,...N. Chefland wars are about to begin. In a war, 2 kingdoms fight each other, winner gets his/her opponent's kingdom. You have to answer Q queries. Queries are of 2 types: Type 1 queries consist of single integer X: find the number of kingdoms captured by the Xth kingdom (NOTE: If the Xth kingdom is already captured then find the numb
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.
Sign in to chat with the tutor and save your progress.
Sign in to start