TopCoder

拉菲好可愛 >////<
迷子でもいい、迷子でも進め!

User's AC Ratio

100.0% (3/3)

Submission's AC Ratio

80.0% (4/5)

Tags

Description

Input Format

Output Format

Sample Input 1

010100101010001
8
1 11 4 9 3 7 0 11

Sample Output 1

12
8
4
2
2
2
2
4
4

Sample Input 2

1111111
7
6 5 3 1 4 2 0

Sample Output 2

1
1
2
3
4
5
4
1

Sample Input 3

000111111000010101010001111010
12
26 6 29 11 11 28 11 26 5 13 17 26

Sample Output 3

15
30
30
30
24
30
30
24
24
48
72
104
104

Sample Input 4

0110100001100101011011100111100101100001011101000110100001100101011001110110010101101110011010010111010101110011
0

Sample Output 4

172800

Hints

Problem Source

YTP 2023 高中組程式挑戰營 p14

Subtasks

No. Testdata Range Constraints Score
1 0~3 範例測資 0
2 4~12 $|s| \leq 15, q \leq 100$ 2
3 13~19 $s[0] = \texttt{1}$、$s[i] = \texttt{0}$($1 \le i \le |s|-1$)、$q = 0$ 1
4 0~12, 20~23 $|s| \le 3000$、$q \le 3000$ 7
5 13~19, 24~31 所有修改操作都是將 $\texttt{1}$ 變成 $\texttt{0}$ 4
6 0~35 無額外限制 11

Testdata and Limits

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