#abc256f. F - Cumulative Cumulative Cumulative Sum
F - Cumulative Cumulative Cumulative Sum
Score : points
问题描述
给定 、 和数组 。
处理 个查询,每个查询属于以下两种类型之一:
1 x v
:将 更新为 。2 x
:令 ,,以及 。输出 对 取模的结果。
以上为通义千问 qwen-max 翻译,仅供参考。
Problem Statement
You are given , , and .
Process queries, each of which is of one of the following two kinds:
1 x v
: update to .2 x
: let , , and . Print modulo .
Constraints
- All values in input are integers.
Input
Input is given from Standard Input in the following format, where denotes the -th query to be processed:
Each query is given in one of the following two formats:
Output
Print the answer to the queries, with newlines in between.
Sample Input 1
3 3
1 2 3
2 3
1 2 0
2 3
Sample Output 1
15
9
When the -st query is given, , so , , and ; thus, .
When the -rd query is given, , so , , and ; thus, .
Sample Input 2
2 1
998244353 998244353
2 1
Sample Output 2
0
update @ 2024/3/10 10:54:10