Cities Colours
You once again find yourself exploring the beautiful region of Chefland. There are $N$ cities in a row. Each city has a color preference of $C_i$ and has a wealth of $W_i$. Initially, you are at city $1$ with a color of $0$, and you have $0$ coins. For simplicity's sake, it is guaranteed that $C_1=W_1=0$. Then, you may perform any of the following operations: - Set your color to any integer you
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