RG and Chaos
CodeChefOpen on judge ↗
RG loves to create chaos. He has decided to create chaos in the state of Mysteryland. There are n cities in the state of Mysteryland indexed from 1 to n. Initially, there are m cities that are already chaotic. Now, RG can create chaos in a city with index i which is not chaotic only if there is at least one chaotic city with index j such that: absolute difference (i, j) =1. Now, help him find
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