1015: 湖南省第十八届大学生计算机程序设计竞赛(HNCPC2022) - Semilive
开始
Start
结束
End
当前
Now
状态
Status
类型
Type
公开Public
榜单
Rank
公告 Announcement
暂无公告No announcement
C (1191) : Phalanx Dance
时间限制Time Limit
5
秒Sec
内存限制Memory Limit
128
兆MB
提交次数Submitted
25
次Times
通过次数Solved
2
次Times
标准评测Standard Judge
题目描述Description
At the beginning of the phalanx dance, everyone holds a screen with adjustable brightness and stands in an n × n matrix.
The initial brightness of all screens is 0.
There are two actions:
1 a s e: Dancers from s-th to e-th in column a will intermittently increase or decrease the screen brightness by 1, that is, s, s + 2, s + 4, ⋯ increase by 1, while s + 1, s + 3, s + 5, ⋯... turn down 1.
2 a s e b: Dancers from s-th to e-th in column a move to the tail of column b.
For example:
We need to know the sum of the brightness of the columns with action.
输入格式Input
There are 5 test cases. For each case, the first line contains n m means the initial n × n square matrix and m actions.
Then following m lines describing the actions.
It is guaranteed that every action could be executed smoothly.
- 1 ≤ n ≤ 1000
- 1 ≤ m ≤ 105
输出格式Output
For each action, output the total brightness of the relevant column.
Specifically: For action 1, output the total brightness of column a. For action 2, output the total brightness of column a and b separated by a space.