QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#419332#6427. Just Another Game of Stonesrotcar08AC ✓545ms77428kbC++141.9kb2024-05-23 20:25:412024-05-23 20:25:42

详细

Test #1:

score: 100
Accepted
time: 1ms
memory: 5844kb

input:

5 4
1 2 1 4 1
2 1 3 1
1 2 4 3
2 2 4 4
2 1 4 4

output:

1
0
3

result:

ok 3 number(s): "1 0 3"

Test #2:

score: 0
Accepted
time: 266ms
memory: 75896kb

input:

200000 200000
962352030 173642520 1008864183 74920228 684681800 500911321 1001441054 257633652 185843534 59168654 317689197 731348417 123888883 708119712 340055368 876566011 980078202 969174443 814012870 715639041 596932238 173757742 314504576 1045746913 740811577 570187156 999816627 12441059 122507...

output:

38889
57353
46659
19709
34617
138247
1211
755
16087
26119
14051
12263
33399
14363
41869
21117
97277
16733
64611
737
32715
25031
148859
17395
76263
56261
19825
93349
48429
22291
31645
9833
35195
95623
184389
39321
153
6067
6495
25369
9041
35785
39783
111237
151543
54289
121169
165785
101803
101821
15...

result:

ok 99837 numbers

Test #3:

score: 0
Accepted
time: 260ms
memory: 77052kb

input:

200000 200000
962448218 958513200 826817273 288493295 72329606 793844396 161474258 749557053 862074728 135184207 668911451 838765519 576454286 121274388 388348135 263187992 907050448 15832750 818487193 381586607 465699121 602151844 79762183 196026513 582482566 931149307 480935730 159461747 585046007...

output:

18515
12719
24057
31925
17901
115925
146271
104061
8999
158211
146057
111579
31549
925
50509
62041
43485
3087
109093
6501
70803
59687
75457
137021
61153
24695
112325
3009
42565
14461
8419
2077
61229
60333
160819
40045
65745
4959
2349
13803
73683
115339
137585
48641
23943
1473
84973
68993
89153
5491
...

result:

ok 99962 numbers

Test #4:

score: 0
Accepted
time: 242ms
memory: 77048kb

input:

200000 200000
962544405 669642056 644770364 502066363 533719237 13035646 395249287 167738631 464564098 211199761 1020133705 946182622 1029019688 608170888 436640902 723551797 834022694 136232881 822961515 47534172 334466005 1030545946 918761614 420047937 424153555 218369633 1035796657 306482436 1047...

output:

3255
81127
56879
67249
46421
116905
6071
4199
79925
17027
86579
891
62153
89905
97233
63251
10311
629
59525
142181
170519
3593
30971
86945
30873
81313
84145
3727
115629
1579
38801
6967
84659
134727
79203
108359
19231
116677
99273
12449
6909
189769
46489
77353
34309
13175
43589
124695
21251
35733
130...

result:

ok 99924 numbers

Test #5:

score: 0
Accepted
time: 164ms
memory: 77128kb

input:

199999 200000
0 1 0 0 0 0 1 0 1 0 1 1 1 1 1 1 0 0 1 1 1 1 0 0 1 0 0 0 1 0 1 0 1 0 0 1 0 1 0 1 0 0 0 1 1 1 0 1 1 0 1 1 1 1 1 0 0 0 0 1 1 1 1 0 0 0 1 0 1 1 1 1 0 0 0 0 1 1 0 1 1 0 0 0 1 0 0 0 1 0 0 1 0 1 0 0 0 1 0 1 1 1 1 0 0 0 0 1 0 0 0 0 1 0 1 0 1 0 1 1 1 0 1 1 1 1 1 1 0 0 0 0 1 0 1 0 1 1 0 0 0 1 1 ...

output:

0
39093
0
0
7465
0
16579
0
14007
0
0
71337
0
0
0
52371
0
87361
0
21725
8205
0
0
0
0
8837
0
0
64937
0
0
0
62465
0
0
0
0
0
67977
107293
57805
83445
0
98381
0
101425
577
0
0
50485
31097
11921
37185
0
35729
11129
141839
121671
0
0
0
0
0
0
44997
0
0
0
132229
0
0
0
0
70937
0
78495
76809
31585
0
55525
1090...

result:

ok 99939 numbers

Test #6:

score: 0
Accepted
time: 229ms
memory: 75424kb

input:

199999 199998
1514 307 1429 1644 257 1275 1599 1099 231 740 501 1730 30 1561 727 888 1148 152 373 1110 1776 917 304 1115 113 1254 383 1479 23 1954 462 916 1878 1432 1196 189 1274 477 26 1068 800 890 1554 1775 1777 1357 344 1551 1139 1469 168 584 1062 1181 1662 1430 452 1685 1468 565 635 1525 1767 15...

output:

75781
45269
14269
4339
54337
89997
105757
21133
47553
8351
95253
19225
2623
29671
48643
57371
22603
103747
176527
88497
118589
118351
61833
85051
110213
149685
29443
91475
6649
91685
2991
112405
14547
36451
509
107069
28719
8261
45761
9403
421
70013
3859
1619
51015
75363
19885
8387
112275
59989
8261...

result:

ok 100162 numbers

Test #7:

score: 0
Accepted
time: 202ms
memory: 75012kb

input:

199997 199998
0 11 4 13 6 30 28 30 18 13 21 24 4 24 1 9 30 27 12 12 6 30 9 31 16 25 5 5 7 13 24 15 9 10 21 12 27 29 28 8 16 20 9 30 5 11 9 25 6 2 14 26 3 14 23 1 10 11 12 31 22 23 23 0 25 10 2 6 3 31 31 14 20 19 15 2 17 4 2 31 27 20 2 23 5 17 30 30 14 9 25 15 8 31 9 30 13 13 2 0 19 3 21 3 10 4 4 29 ...

output:

7875
57807
95059
7017
30085
5059
123909
151147
34203
40629
119345
20891
1495
23551
32049
5233
37025
33671
43355
107345
87053
44329
126053
31685
6605
42943
45281
39709
3877
15207
89705
138957
70835
64647
23691
94099
84845
138199
7169
122397
126567
92163
180731
106401
68389
87627
64683
66505
49689
320...

result:

ok 100039 numbers

Test #8:

score: 0
Accepted
time: 239ms
memory: 75636kb

input:

200000 199999
4668 9598 10065 1023 4382 4541 16076 6223 325 7399 1681 11611 3915 12625 12012 3101 5877 10437 9827 4056 8839 7887 6919 6658 16307 4 2396 10023 7090 14603 4497 8402 11451 15937 12760 11208 1607 9783 12103 70 10618 14003 13963 225 7920 923 7255 13883 14042 7001 13603 6542 11491 5461 104...

output:

15847
73885
22405
26241
48215
49369
40595
22865
48395
1575
291
4075
77029
10367
73843
69795
52887
217
22145
85331
114429
24843
86459
83201
88993
743
49911
4483
123713
106695
19553
17135
83157
6279
60539
136965
78317
50811
116463
42387
71667
118363
75379
177487
25143
135211
17139
17189
102417
40571
2...

result:

ok 100009 numbers

Test #9:

score: 0
Accepted
time: 218ms
memory: 77332kb

input:

199998 199999
142 205 18 177 86 154 20 205 121 127 136 164 89 198 108 17 193 107 206 25 224 255 143 214 119 49 32 14 164 92 204 139 23 155 224 250 86 71 153 190 198 16 102 22 202 192 148 228 129 200 52 244 74 54 140 195 146 111 185 99 115 176 123 151 92 68 39 101 60 45 49 85 44 225 137 42 32 99 22 1...

output:

61577
50809
20245
3463
46573
697
29129
81569
42515
57877
49169
82665
174741
65341
140177
13599
81267
21019
57693
136139
28817
76985
56417
80901
84037
21429
115749
110433
20955
73557
50325
68897
174761
134159
31961
91919
136631
29109
34579
153003
15239
89219
15355
22363
53619
23041
97471
45965
1143
6...

result:

ok 99994 numbers

Test #10:

score: 0
Accepted
time: 184ms
memory: 75472kb

input:

199998 200000
3 0 2 1 1 3 0 0 3 2 3 2 1 3 0 3 0 0 0 3 0 2 2 1 3 1 0 2 3 3 1 2 1 0 3 1 2 3 1 1 3 1 3 0 0 1 2 3 0 0 2 2 3 0 1 0 2 3 1 0 3 2 1 3 0 2 2 1 3 1 3 1 3 2 0 2 3 0 0 0 3 0 0 2 1 0 1 2 2 1 3 3 0 1 2 1 1 1 2 3 0 3 1 3 2 2 1 1 2 2 1 3 2 3 3 2 0 0 1 2 2 1 2 2 1 1 3 1 1 3 1 1 0 0 3 1 3 2 0 1 3 0 1 ...

output:

56449
4915
71985
0
14371
0
0
0
11541
0
4637
42757
117321
0
62371
55519
57973
70817
8045
49393
86579
13985
67567
61477
24491
3035
0
0
109851
27473
94247
18935
67291
161183
0
25639
30009
0
62841
68297
19869
98727
15201
26151
18907
53265
0
99531
24917
0
30305
123295
56273
60597
51773
0
136061
29285
928...

result:

ok 99984 numbers

Test #11:

score: 0
Accepted
time: 243ms
memory: 76988kb

input:

199996 199999
423 978 4050 3898 1965 1058 1152 2638 1557 2402 1592 2067 2356 3207 3276 3369 2275 4018 924 3298 2244 129 3412 2861 1659 2384 348 3873 264 1214 3470 2501 3570 3614 291 2340 3326 2634 1340 933 139 1985 2015 957 1666 601 3499 4023 3310 2013 3901 286 1945 3964 1521 1944 3295 2093 270 3268...

output:

6575
8081
6797
63763
75137
101097
45843
133997
5535
144715
38071
80853
14769
12365
17311
35777
47393
88781
29301
144099
13657
60523
79485
129717
29143
109805
12885
66583
79959
23397
12173
84345
83227
55747
146569
26455
73927
51239
38651
88431
42017
68795
22837
29077
65731
71843
126181
104623
59571
1...

result:

ok 100071 numbers

Test #12:

score: 0
Accepted
time: 200ms
memory: 77408kb

input:

199999 199999
12 14 14 18 17 18 12 2 26 20 26 13 22 25 15 22 30 24 13 21 28 17 31 4 28 24 2 12 8 24 11 20 8 16 5 27 1 10 6 31 5 22 1 9 22 27 31 0 14 27 10 20 2 27 9 26 29 1 23 16 19 20 3 14 23 21 24 22 29 15 0 5 14 25 3 25 16 9 4 18 5 10 8 27 20 17 6 13 18 15 3 13 6 16 13 3 27 1 21 2 0 30 15 18 15 1...

output:

42389
23651
35637
43497
15619
76783
23709
58127
48189
44217
124433
30287
74693
50697
32599
87317
2917
24825
130475
47401
29545
94103
20077
126207
91967
169477
21031
59985
14139
124879
116201
114249
102707
53191
11817
46837
32709
62531
26469
35963
5567
155869
4559
32811
162027
8795
76991
118151
94243...

result:

ok 99941 numbers

Test #13:

score: 0
Accepted
time: 262ms
memory: 77428kb

input:

199997 200000
21267 22099 29656 6927 20364 29906 15775 15966 9409 22167 8072 12080 26203 25934 5819 18945 11587 17823 21070 16721 7222 2136 3505 18359 11310 31786 1449 27354 15914 7644 29348 22145 21420 5095 8717 5340 9444 234 1731 23278 9553 29647 19180 12463 734 17717 4219 2366 3571 6593 22961 601...

output:

18615
52241
102109
97415
146361
28759
7161
6431
21699
82941
22897
121947
54375
39853
22169
85437
140233
35401
88891
122477
125001
5331
174705
51625
83391
30551
122689
113755
50633
81111
74907
126349
178885
44513
137139
43139
8615
12451
106295
33699
49835
55055
97045
105695
38169
49257
30093
3347
120...

result:

ok 99974 numbers

Test #14:

score: 0
Accepted
time: 51ms
memory: 6028kb

input:

98 199999
0 1 1 1 0 0 1 0 1 0 1 1 1 0 0 1 1 0 0 1 0 1 0 0 1 0 0 0 0 1 1 1 1 1 0 1 0 1 0 1 1 0 0 1 1 0 1 0 0 1 1 0 1 0 0 1 1 1 1 0 0 1 0 1 1 1 0 1 1 1 1 0 0 0 0 1 0 0 1 0 0 1 0 0 0 0 1 1 1 1 0 0 0 1 0 0 1 0
1 53 92 0
1 20 76 0
2 26 76 0
2 66 80 1
2 34 53 0
1 80 81 1
1 4 77 0
2 64 98 0
1 14 22 1
2 5 9...

output:

0
0
11
0
53
0
0
23
0
15
21
0
0
0
0
0
27
0
39
15
0
37
13
0
0
0
15
0
37
57
0
0
0
0
31
0
0
0
0
0
1
49
0
0
63
7
0
0
0
73
0
0
39
5
0
0
0
0
0
0
81
3
0
0
53
0
3
45
39
0
3
65
0
0
0
0
13
51
0
0
0
0
55
0
0
9
0
21
5
0
0
75
0
49
0
0
0
53
0
0
7
0
0
0
0
0
0
0
15
19
0
17
31
0
33
0
0
5
35
0
77
87
0
0
45
0
0
0
0
0
1...

result:

ok 100224 numbers

Test #15:

score: 0
Accepted
time: 57ms
memory: 6032kb

input:

100 199998
891 1493 48 746 916 808 1632 1676 646 491 87 1168 103 709 1647 1699 326 254 1448 1415 879 272 1207 1880 325 797 115 1307 1319 178 802 1098 34 1221 992 1659 1376 796 1983 791 168 1245 1444 1761 5 1722 1436 284 1871 2034 470 1159 324 548 327 371 2046 174 1265 120 1624 991 193 329 905 536 19...

output:

23
3
1
17
5
5
7
19
21
73
9
9
15
17
61
57
1
5
9
17
7
15
33
55
29
25
29
37
79
85
79
45
41
37
37
47
41
41
45
17
37
47
79
49
9
55
19
25
15
59
3
33
35
51
53
19
49
15
7
17
13
39
77
21
21
43
55
31
9
77
11
1
19
11
29
21
39
69
19
27
19
39
27
5
71
39
63
33
3
3
61
41
11
5
3
59
43
49
55
55
23
13
51
29
9
3
29
69...

result:

ok 100162 numbers

Test #16:

score: 0
Accepted
time: 55ms
memory: 8072kb

input:

99 199998
11 15 7 15 8 11 14 3 12 4 7 8 2 5 7 11 8 14 14 8 12 10 11 5 10 9 0 1 13 8 14 9 6 3 9 1 14 1 13 2 3 13 4 14 4 8 13 2 9 5 9 1 11 2 1 8 1 9 4 12 2 7 15 7 3 11 8 12 12 14 13 2 10 7 7 12 13 10 14 14 11 1 5 7 7 6 10 7 6 12 9 0 6 9 15 13 3 15 8
2 7 16 10
1 8 58 15
2 11 68 11
2 47 98 1
1 3 22 1
1 ...

output:

5
55
37
15
19
11
55
0
33
15
25
61
75
9
47
19
3
37
3
71
0
19
59
3
37
17
43
63
13
5
73
5
49
63
21
37
25
43
93
3
35
29
43
3
55
57
7
0
7
43
0
57
41
55
0
39
55
29
39
27
23
51
25
61
27
79
7
33
19
41
41
75
61
39
17
65
85
19
23
35
17
23
31
49
49
13
99
41
19
21
61
7
95
39
29
67
51
0
27
25
3
19
41
17
17
39
1
...

result:

ok 100027 numbers

Test #17:

score: 0
Accepted
time: 54ms
memory: 5872kb

input:

99 199999
16075 2696 15396 10227 9650 803 16334 10836 3645 5402 14751 7123 4498 5814 2987 9589 15684 11259 2040 6488 1665 2731 14148 12772 1619 12737 253 8642 1070 391 7212 9857 13087 14243 11133 6586 2425 12337 11375 14240 5566 465 13082 107 10131 3843 15986 3747 3519 11519 16021 11137 5585 395 161...

output:

21
39
29
19
11
11
9
29
5
31
11
41
33
45
31
17
19
29
5
53
33
17
57
15
9
19
3
45
5
17
69
19
57
19
41
23
21
31
17
43
27
29
51
17
17
9
49
63
17
53
3
39
37
61
47
43
63
19
15
9
37
71
51
19
7
49
67
35
39
23
53
31
3
45
27
7
73
43
17
15
83
15
21
17
31
65
61
71
81
23
65
1
9
75
3
3
53
17
3
13
33
19
33
11
33
37...

result:

ok 99906 numbers

Test #18:

score: 0
Accepted
time: 55ms
memory: 5876kb

input:

98 200000
65 97 101 65 168 96 24 21 173 95 84 93 98 91 223 118 91 119 85 63 112 174 0 53 145 248 254 248 70 126 246 162 48 129 198 178 98 111 142 156 119 61 88 20 237 238 28 70 221 14 90 60 238 230 229 63 89 178 160 44 239 110 182 3 205 167 149 246 222 33 16 17 50 192 132 221 111 243 230 84 14 101 1...

output:

33
23
3
57
33
15
19
5
5
47
13
53
3
31
31
91
67
39
21
31
49
77
19
77
9
17
65
7
3
3
21
59
31
5
3
35
23
47
35
5
21
19
29
21
47
77
29
33
23
55
45
31
23
25
25
23
11
1
31
81
21
23
3
71
65
29
21
23
51
25
69
25
41
5
13
51
79
9
31
19
53
15
13
1
15
9
19
49
1
11
43
35
79
7
17
35
9
57
27
67
49
21
55
19
37
85
0
...

result:

ok 99814 numbers

Test #19:

score: 0
Accepted
time: 54ms
memory: 5952kb

input:

100 200000
2 2 3 3 2 2 0 2 0 1 3 1 1 1 2 1 3 0 2 0 3 0 0 2 0 0 3 1 1 3 1 2 2 0 3 3 2 0 1 1 2 1 3 0 0 2 1 1 2 1 2 3 2 3 3 2 1 0 1 3 1 1 2 1 2 0 0 0 1 0 2 0 3 1 0 1 0 2 3 0 2 2 1 1 3 3 0 0 2 3 2 1 1 0 1 1 1 3 0 3
2 43 91 1
2 6 67 3
2 15 61 0
2 24 59 2
2 1 10 3
2 2 27 2
2 78 93 0
1 74 93 1
1 19 55 3
2 ...

output:

23
29
23
19
0
11
9
7
33
0
3
0
5
13
15
1
15
0
29
15
0
0
7
31
0
11
11
41
9
23
0
47
37
19
3
15
29
33
25
29
0
69
7
0
0
0
25
3
55
0
15
0
25
37
11
1
0
65
41
0
0
91
9
51
45
0
93
0
0
0
0
0
11
55
0
25
21
39
33
23
27
5
33
89
91
0
59
15
39
71
0
0
3
0
31
7
27
49
63
13
49
13
1
25
13
51
0
0
0
19
77
49
0
23
9
79
8...

result:

ok 99979 numbers

Test #20:

score: 0
Accepted
time: 507ms
memory: 75008kb

input:

199999 199999
0 1073741823 0 1073741823 0 1073741823 0 1073741823 0 1073741823 0 1073741823 0 1073741823 0 1073741823 0 1073741823 0 1073741823 0 1073741823 0 1073741823 0 1073741823 0 1073741823 0 1073741823 0 1073741823 0 1073741823 0 1073741823 0 1073741823 0 1073741823 0 1073741823 0 1073741823 ...

output:

55025
8993
915
5389
28973
59355
16905
83451
51757
93197
80451
68971
12505
8563
82931
95853
67107
35213
7935
41673
53037
105743
43731
3685
41941
6027
62079
22673
15819
21145
34361
20939
43163
13237
50659
53393
10103
81031
35675
593
39891
31493
68053
108477
18369
17141
57865
108469
1143
9751
13455
102...

result:

ok 99996 numbers

Test #21:

score: 0
Accepted
time: 545ms
memory: 77136kb

input:

199999 199999
0 1073741823 0 1073741823 0 1073741823 0 1073741823 0 1073741823 0 1073741823 0 1073741823 0 1073741823 0 1073741823 0 1073741823 0 1073741823 0 1073741823 0 1073741823 0 1073741823 0 1073741823 0 1073741823 0 1073741823 0 1073741823 0 1073741823 0 1073741823 0 1073741823 0 1073741823 ...

output:

77487
10845
5779
4319
8363
26939
19157
45911
30769
45079
9057
74073
44601
22691
185
15925
64295
4213
417
13501
6539
17969
29961
72369
24201
36081
112417
35099
73803
29205
107865
6455
80681
35843
48653
25577
80979
22079
19755
63187
985
16297
46355
17359
587
68343
78035
5001
25739
28999
50561
39805
19...

result:

ok 99997 numbers

Test #22:

score: 0
Accepted
time: 531ms
memory: 77128kb

input:

200000 199998
0 1073741823 0 1073741823 0 1073741823 0 1073741823 0 1073741823 0 1073741823 0 1073741823 0 1073741823 0 1073741823 0 1073741823 0 1073741823 0 1073741823 0 1073741823 0 1073741823 0 1073741823 0 1073741823 0 1073741823 0 1073741823 0 1073741823 0 1073741823 0 1073741823 0 1073741823 ...

output:

0
20705
44949
77983
46261
22885
4411
7601
12281
3021
9955
24759
19189
42767
17377
9085
58801
10201
8431
124461
94581
75161
33779
39251
1213
67393
18623
91699
63889
7801
25321
11139
475
29045
5793
74845
5493
2675
46989
11095
38431
46879
10127
91417
8323
81211
17221
72873
9963
92757
150229
145899
5592...

result:

ok 100025 numbers

Test #23:

score: 0
Accepted
time: 64ms
memory: 77192kb

input:

200000 200000
0 1073741823 0 1073741823 0 1073741823 0 1073741823 0 1073741823 0 1073741823 0 1073741823 0 1073741823 0 1073741823 0 1073741823 0 1073741823 0 1073741823 0 1073741823 0 1073741823 0 1073741823 0 1073741823 0 1073741823 0 1073741823 0 1073741823 0 1073741823 0 1073741823 0 1073741823 ...

output:

40029

result:

ok 1 number(s): "40029"