Intersegment Activation
시간 제한2초메모리 제한1024 MB
매 라운드 보이는 칸 수만 보고하면서, 각 구간을 덮는 장벽을 뒤집어 모든 칸이 보이도록 만든다.
문제
This is an interactive problem.
There is an array of cells, numbered from to . For each pair of integers , where , there is a barrier covering all cells from to , inclusive. Each barrier is either active or inactive. A cell is visible if there are no active barriers that cover it. Otherwise, the cell is invisible.
The state of each barrier is unknown to you. All you can observe is the number of visible cells. But you can flip the state of any barrier: if it's active, it turns inactive, and the other way around. Your task is to make all barriers inactive, so that all cells become visible.
힌트

In the example, initially, only two barriers, and , are active. These two barriers cover all three cells, so is equal to 0 in the first round.
- After flipping the barrier, there are now three active barriers, and still visible cells.
- After flipping the barrier, cell becomes visible, so now there is visible cell.
- After flipping the barrier, cell also becomes visible. The only invisible cell now is , covered by the only active barrier, , and there are visible cells.
- After flipping the barrier, all barriers are now inactive, and all cells are visible. After reading , the program terminates.