← All problemsSign in

Colored Chairs

CSESInteractive ProblemsOpen on judge ↗

There are n chairs arranged in a circle. Each chair is either red or blue. The chairs are numbered 1, 2,\dots, n; chairs i and i+1 are next to each other for all 1 \le i \le n. Here chair n+1 refers to chair 1. Your task is to find two chairs that have the same color and are next to each other. To do this, you can ask questions: you can choose a chair and you will be told the color of that chair

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