A Light Inconvenience

시간 제한1초메모리 제한1024 MB

요약
각 막에서 오른쪽으로 불을 번지게 할 값 t를 정해, 불이 켜진 횟불 수를 150개 이하로 유지하면서 가장 오른쪽 횟불이 켜져 있게 만든다.
난이도

어려움10점 중 8점

유형
그리디, 구현, 시뮬레이션
정답자
아직 제출이 없습니다

문제

The Scientific Committee is relaxing at the opening ceremony of this year’s CEOI. The tasks are prepared, the grading server’s 101210^{12} firewalls are finally up, and the committee is looking forward to an amazing show with flaming torches. Nothing can go wrong. Except… no one bought enough oil for those torches! Now the committee needs help to run the show without using up their oil supplies.

During the show, there will be performers standing in a line, numbered from left to right starting at 11. The number of performers will vary over time. Each performer holds a torch which may or may not be on fire at any point in time. Initially, there is only one performer whose torch is on fire.

The show is divided into QQ acts. At the beginning of act aa, either p_a>0p\_a > 0 performers decide to join the line on the right, or the rightmost p_a>0p\_a > 0 performers decide to leave. This is out of the committee’s control. The leftmost performer always remains on stage. The torches of joining performers are not on fire, and leaving performers extinguish their torches if they are on fire.

As soon as the line of performers for act aa is ready, the committee has to announce a number t_a≥0t\_a ≥ 0. Then, each performer whose torch is on fire shares their fire with the t_at\_a performers on their right. This means that the torch of performer ii will be on fire afterwards if and only if the torch of at least one of the performers max⁡i−t_a,1,…,i\max\\{i − t\_a , 1\\}, \dots , i was on fire beforehand. For a more dynamic show, t_at\_a must not be larger than 5p_a5p\_a, and should be as low as possible (see the grading section below).

At the end of each act, the committee has to tell every performer whose torch is currently on fire whether to extinguish it or not. For aesthetic reasons, the torch of the rightmost performer should always be on fire after that. Moreover, to conserve oil, the number of torches left on fire must not be larger than 150150.

Write a program that tells the committee how to run the show within these constraints.

예제

이 문제는 공개된 예제가 없습니다.