PivotOJ

Going in Circles

시간 제한: 2000ms메모리 제한: 1024MB출처: NWERC 2022BOJ 26180

문제

Hercule Poirot, world-renowned detective, was having a lovely cup of tea in his compartment on the Disorient Express when the train conductor rushed in. "We have lost track of the number of train carriages," exclaimed the conductor. You see, this was no ordinary train, and had no first or last train carriage. Instead, the train carriages were connected to form a large cycle, causing the conductor's confusion.

Hercule thought for a moment. "That is most peculiar," he said. "But I may be able to help you." He reached over and grabbed the lamp from the side table. "You see, each train carriage has a light switch like this one. By moving between the carriages and toggling these switches, we can determine the number of train carriages."

The conductor was sceptical, but agreed to try it. "We are in a hurry," he said, "so please determine nn, the number of carriages that the train consists of, in at most 3n+5003n+500 steps." Here a step counts as either moving to an adjacent carriage or toggling a light switch in the current carriage. "The only thing I am certain of is that nn is at least 33 and at most 50005000."

예제

예제 1

입력
0

1

1

0

1

1

1

1
출력
? right

? right

? right

? flip

? left

? left

? left

! 3
이 문제는 채점 준비 중입니다. 테스트 데이터가 확보되면 제출이 가능합니다.