欢迎来到起遇信息学
起遇信息学正处于上线筹建阶段,以下功能已全部开放免费体验: ✅ 完整题库浏览与代码提交评测(C / C++ / Python / Java 等) ✅ 入门到进阶的系列课程试读、作业与考试 ✅ AI 提示、AI 作业分析等智能助教功能 ✅ 赛事模拟与个人能力报告 ✅ 邮箱注册开放 ⏳ 付费课程订阅与微信/支付宝支付通道 ⏳ 手机号登录,微信扫码登录、微信公众号绑定 使用中如遇任何问题,欢迎通过页面底部 **"联系我们"** 与我们沟通。
CF2007B.Index and Maximum Value
Index and Maximum Value
After receiving yet another integer array at her birthday party, Index decides to perform some operations on it.
Formally, there are operations that she is going to perform in order. Each of them belongs to one of the two types:
+ l r. Given two integers and , for all such that , set .- l r. Given two integers and , for all such that , set .
For example, if the initial array , after performing the operation , the array . Then, after performing the operation , the array .
Index is curious about the maximum value in the array . Please help her find it after each of the operations.
Input
Each test consists of multiple test cases. The first line contains a single integer () — the number of test cases. The description of the test cases follows.
The first line of each test case contains two integers and (, ) — the length of the array and the number of operations.
The second line of each test case contains integers () — the initial array .
Then lines follow, each line corresponds to the operation, in the following format: c l r (, and are integers, ) — the description of the operation.
Note that the elements may not satisfy after some operations, as it is shown in the example.
It is guaranteed that the sum of over all test cases does not exceed , and the sum of over all test cases does not exceed .
Output
For each test case, output one single line containing integers, with the -th of them describing the maximum value of the array after the -th operation.
Note
In the first test case, the process of the operations is listed below:
- After the first operation, the array becomes equal . The maximum value is .
- After the second operation, the array becomes equal . The maximum value is .
- After the third operation, the array becomes equal . The maximum value is .
- After the fourth operation, the array becomes equal . The maximum value is .
- After the fifth operation, the array becomes equal . The maximum value is .
In the second test case, the process of the operations is listed below:
- After the first operation, the array becomes equal . The maximum value is .
- After the second operation, the array becomes equal . The maximum value is .
- After the third operation, the array becomes equal . The maximum value is .
- After the fourth operation, the array becomes equal . The maximum value is .
- After the fifth operation, the array becomes equal . The maximum value is .
Samples
5
5 5
1 2 3 2 1
+ 1 3
- 2 3
+ 1 2
+ 2 4
- 6 8
5 5
1 3 3 4 5
+ 1 4
+ 2 3
- 4 5
- 3 3
- 2 6
5 5
1 1 1 1 1
+ 2 3
- 4 5
+ 1 6
- 2 5
+ 1 8
1 1
1
- 1 1
1 1
1000000000
+ 1000000000 1000000000
4 4 4 5 5
5 5 4 4 3
1 1 2 1 2
0
1000000001
在线编程 IDE
建议全屏模式获得最佳体验
| 进入全屏编程 | Alt+E |
| 递交评测 | Ctrl+Enter |
| 注释/取消注释 | Ctrl+/ |
| 缩放字体 | Ctrl+滚轮 |