Couples sit next to each other
There are N couples numbered 1 through N. Each couple consists of two people. There are also 2N chairs numbered 1 through 2N. Each chair has a person sitting on it; for each i (1 ≤ i ≤ 2N), the person initially sitting on chair i belongs to couple number Ai. The chairs are placed in a circle, so chairs i and i+1 are adjacent for each 1 ≤ i ≤ 2N-1; chairs 2N and 1 are also adjacent. You may perfor
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