#P11366. [Ynoi2024] 末日的魔法少女计划
[Ynoi2024] 末日的魔法少女计划
Background












Problem Description
Given a monoid with identity , and a sequence consisting of elements in , with all initial values being , you need to support operations. Each operation is either a point update or a range sum query.
For each update operation, the number of times you use must not exceed .
For each query operation, the number of times you use must not exceed .
Basic properties of the monoid:
This is an interactive problem. You need to include the header lib.h, or put its content at the very beginning of your program.
The content of the provided header lib.h is:
struct Data{
unsigned short a,b,c,d;
};
Data operator+(Data a,Data b);
void init(int n,int k,Data d);
void update(int x,Data d);
Data query(int l,int r);
Here, Data represents , and Data operator+ represents . The interactive library provides the implementation of these parts.
You need to implement:
init, used for initialization. Here n,k,d represent , and the identity element of , respectively. You may use , but since , you cannot obtain useful results from it.
update, which represents an update operation, setting to .
query, which represents a range sum query operation, querying . The query result should be returned as the return value.
Hint
Idea: ccz181078, Solution: ccz181078, Code: ccz181078, Data: ccz181078.
For all testdata, .
Constraints
| Subtask ID | Score | ||
|---|---|---|---|
| 1 | 4000 | 2 | 11 |
| 2 | 700 | 3 | 7 |
| 3 | 400 | 4 | 5 |
| 4 | 200 | 5 | 4 |
| 5 | 6 | ||
| 6 | 100 | 7 | 3 |
| 7 | 80 | 8 | |
| 8 | 60 | 9 | |
| 9 | 2811 | 2 | 16 |
| 10 | 542 | 3 | 11 |
| 11 | 272 | 4 | 8 |
| 12 | 137 | 5 | 7 |
| 13 | 113 | 6 | 5 |
| 14 | 75 | 7 | |
| 15 | 69 | 8 | 4 |
| 16 | 48 | 9 |
The lib\down directory contains the provided interactive library files.
The lib\require directory contains the interactive library files used for judging.
The data directory contains the judging test points.
The data2 directory contains the provided samples.
Translated by ChatGPT 5