#P16446. [XJTUPC 2026] 修罗指数
[XJTUPC 2026] 修罗指数
Problem Description
You are playing a “multi-character romance simulation game” and are trying to romance characters at the same time. For the -th character, there are two key values:
- : her tolerance toward you;
- : her expectation of you.
Initially, the status of all characters is given and identical: ().
Next, you will perform actions. Each action is one of the following three types:
-
: you “mess up collectively” with the first characters, causing their tolerance to decrease.
That is, for all (), .
-
: you give gifts to the -th through the -th characters, causing their expectations to increase.
That is, for all (), .
-
: query the “Shura Index” of the -th through the -th characters.
The “Shura Index” is defined as .
Input Format
The first line contains three integers and (), separated by a single space, representing the number of characters, the initial tolerance value, and the initial expectation value.
The second line contains an integer (), indicating the number of actions.
The next lines each contain three integers separated by a single space. These three integers correspond to one of the following cases, representing one action:
- (), meaning that for all (), .
- (), meaning that for all (), .
- (), meaning to query the “Shura Index” for the -th through the -th characters.
Output Format
For each action that queries the “Shura Index”, output one line containing one integer, representing the value of the “Shura Index”.
11 38 11
21
3 4 7
2 3 23
3 2 6
2 9 29
3 3 4
1 11 13
3 2 7
1 1 38
3 1 8
1 9 11
3 2 8
1 11 33
3 1 10
2 9 25
3 2 10
1 10 31
3 1 3
1 3 39
3 3 8
2 7 21
3 5 9
108
87
30
52
64
72
106
106
12
72
66
Hint
Translated by ChatGPT 5