TopCoder

Caido
主唱太拼命了

User's AC Ratio

100.0% (4/4)

Submission's AC Ratio

58.3% (7/12)

Tags

Description

Input Format

Output Format

Sample Input 1

3
1 1
10 10 10
10
3 1
1 1 3
3 1
3 2
3 3
2 2 3
1 3 1
3 1
3 2
3 3

Sample Output 1

0
9
3
3
11
4
8

Sample Input 2

8
1 1 3 4 3 5 1
544420781 729609648 110923301 240695139 305509796 177030453 789149504 251576103
11
3 6
1 4 100
2 7 2
1 6 48763
3 5
2 2 6
1 2 114514
2 5 7
3 3
2 2 6
3 1

Sample Output 2

0
3055097
13363544
13363544

Hints

Problem Source

YTP 2024 高中組初賽 p7

Subtasks

No. Testdata Range Constraints Score
1 0~1 範例測資 0
2 0~15 $N, Q \leq 5000$ 3
3 0~27 無額外限制 17

Testdata and Limits

No. Time Limit (ms) Memory Limit (VSS, KiB) Output Limit (KiB) Subtasks
0 5000 1048576 65536 1 2 3
1 5000 1048576 65536 1 2 3
2 5000 1048576 65536 2 3
3 5000 1048576 65536 2 3
4 5000 1048576 65536 2 3
5 5000 1048576 65536 2 3
6 5000 1048576 65536 2 3
7 5000 1048576 65536 2 3
8 5000 1048576 65536 2 3
9 5000 1048576 65536 2 3
10 5000 1048576 65536 2 3
11 5000 1048576 65536 2 3
12 5000 1048576 65536 2 3
13 5000 1048576 65536 2 3
14 5000 1048576 65536 2 3
15 5000 1048576 65536 2 3
16 5000 1048576 65536 3
17 5000 1048576 65536 3
18 5000 1048576 65536 3
19 5000 1048576 65536 3
20 5000 1048576 65536 3
21 5000 1048576 65536 3
22 5000 1048576 65536 3
23 5000 1048576 65536 3
24 5000 1048576 65536 3
25 5000 1048576 65536 3
26 5000 1048576 65536 3
27 5000 1048576 65536 3