#P4560. [IOI 2014] Wall 砖墙
[IOI 2014] Wall 砖墙
Description
You are given a sequence of length with all initial values equal to . You need to support the following two operations:
- Add : For all elements in that are less than , set them to . Do not change elements whose height is greater than .
- Remove : For all elements in that are greater than , set them to . Do not change elements whose height is less than .
You need to output the sequence after performing operations.
Input Format
The first line contains two positive integers , representing the number of elements in the sequence and the number of operations. Note: indices are numbered from to .
Each of the next lines contains integers . If , it denotes an Add operation; if , it denotes a Remove operation. The meanings of are as described above.
Output Format
Output lines. The integer on the -th line is the value of the element with index after all operations.
10 3
1 3 4 91220
1 5 9 48623
2 3 5 39412
0
0
0
39412
39412
39412
48623
48623
48623
48623
10 6
1 1 8 4
2 4 9 1
2 3 6 5
1 0 5 3
1 2 2 5
2 6 7 0
3
4
5
4
3
3
0
0
1
0
Hint
- Subtask #1 (8 points): , .
- Subtask #2 (24 points): , , all Add operations appear before all Remove operations.
- Subtask #3 (29 points): , .
- Subtask #4 (39 points): , .
Constraints: For all operations, the height satisfies .
Translated by ChatGPT 5
京公网安备 11011102002149号