QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#797554#9802. Light Up the Griducup-team3935#AC ✓222ms15884kbC++232.3kb2024-12-03 12:16:492024-12-03 12:16:51

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 202ms
memory: 15144kb

input:

2 1000 100 10 1
4
10
00

01
00

00
10

00
01
1
11
11

output:

1121
2

result:

ok 2 number(s): "1121 2"

Test #2:

score: 0
Accepted
time: 131ms
memory: 10720kb

input:

2 1 1 1 1
4
10
00

01
00

00
10

00
01
1
11
11

output:

5
2

result:

ok 2 number(s): "5 2"

Test #3:

score: 0
Accepted
time: 129ms
memory: 11828kb

input:

1 1000000 1000000 1000000 1000000
1
11
11

output:

2000000

result:

ok 1 number(s): "2000000"

Test #4:

score: 0
Accepted
time: 196ms
memory: 12004kb

input:

10000 8 2 7 8
8
00
01

00
11

00
10

11
11

10
10

01
10

01
00

10
11
8
11
01

11
00

01
10

11
11

00
01

01
01

01
00

11
10
9
00
00

01
01

10
11

00
01

11
10

11
00

11
11

00
11

01
10
9
11
11

10
00

11
00

11
01

00
10

01
11

00
01

01
01

10
01
11
00
01

01
01

10
10

00
11

11
11

11
10
...

output:

34
32
36
36
40
36
42
38
40
41
36
44
34
37
37
32
29
39
39
40
38
39
44
37
29
37
37
38
34
34
32
41
34
36
41
40
44
34
37
34
29
36
39
40
42
35
39
37
38
38
41
29
40
41
36
41
43
40
41
34
42
39
37
33
34
38
38
37
42
40
34
36
28
34
32
38
36
39
38
37
36
38
34
34
34
34
42
40
38
38
40
40
37
40
38
29
36
40
36
34
...

result:

ok 10000 numbers

Test #5:

score: 0
Accepted
time: 196ms
memory: 10840kb

input:

10000 73 78 73 17
11
01
10

01
11

10
00

11
11

00
00

11
01

10
11

11
10

00
11

10
01

01
00
6
00
00

10
11

11
10

01
01

11
01

11
00
7
01
11

01
00

10
00

10
11

10
10

00
00

01
01
10
10
01

10
10

00
10

10
11

10
00

01
01

01
10

11
11

11
00

00
01
10
11
11

01
11

10
10

01
01

00
01

...

output:

523
382
287
579
523
596
343
275
343
472
382
343
455
326
433
360
579
545
506
523
326
528
467
382
438
421
377
460
416
579
489
596
309
326
326
596
438
387
506
562
523
377
416
309
523
348
365
343
416
392
343
399
348
506
421
596
450
426
579
370
506
185
489
377
489
387
416
472
314
489
506
450
421
433
416
...

result:

ok 10000 numbers

Test #6:

score: 0
Accepted
time: 195ms
memory: 11656kb

input:

10000 701 328 455 703
7
10
11

00
01

00
11

00
10

01
00

11
11

11
00
7
00
01

01
00

00
11

11
11

00
00

11
10

11
01
6
01
10

01
01

00
01

00
11

10
01

11
00
8
00
11

10
11

00
10

00
01

11
10

01
01

10
10

11
00
5
00
11

10
11

11
00

01
10

01
00
7
00
01

10
10

11
01

00
10

10
00

11
11...

output:

3124
3124
2595
4153
2595
3177
3907
2796
4235
3833
3296
2595
4809
3579
3579
3050
3169
3907
3907
3251
3169
2714
2595
3050
3251
3542
2796
3251
4563
3251
3452
3907
3251
3251
4034
4034
1730
2140
3087
4153
3907
3907
4727
4809
2923
3497
3579
3431
3251
4235
2267
4354
2595
4153
3169
4727
3087
4235
3579
2595
...

result:

ok 10000 numbers

Test #7:

score: 0
Accepted
time: 210ms
memory: 10692kb

input:

10000 6459 225 8979 7226
16
00
11

11
01

10
01

10
10

00
01

01
11

11
00

11
11

00
10

11
10

01
01

01
00

01
10

10
00

00
00

10
11
16
10
00

11
10

01
10

11
11

00
01

00
00

01
00

01
11

01
01

10
01

00
10

10
10

00
11

11
01

10
11

11
00
16
10
11

01
11

10
00

10
10

01
00

11
11

01...

output:

22302
22302
22302
22302
22302
22302
22302
22302
22302
22302
22302
22302
22302
22302
22302
22302
22302
22302
22302
22302
22302
22302
22302
22302
22302
22302
22302
22302
22302
22302
22302
22302
22302
22302
22302
22302
22302
22302
22302
22302
22302
22302
22302
22302
22302
22302
22302
22302
22302
22302
...

result:

ok 10000 numbers

Test #8:

score: 0
Accepted
time: 211ms
memory: 14708kb

input:

10000 47809 35506 569 26740
5
00
01

10
10

11
01

11
11

00
11
8
11
01

10
10

11
00

01
00

10
01

01
10

10
00

00
10
6
01
10

11
00

00
11

11
11

10
01

01
01
8
00
10

10
01

01
10

10
11

00
00

00
11

01
01

11
10
6
01
11

10
01

00
10

00
00

10
00

01
10
8
00
01

01
10

01
11

00
00

10
10
...

output:

119959
122235
38351
122235
87298
122235
122804
122804
122804
85591
123373
123942
121097
86160
122235
123942
122235
85591
86729
124511
122804
122235
88436
123373
122804
122235
124511
85591
121666
49516
122235
122235
122235
121666
86160
121097
125649
123373
87867
121097
123373
123942
123373
120528
123...

result:

ok 10000 numbers

Test #9:

score: 0
Accepted
time: 207ms
memory: 12200kb

input:

10000 947705 1031 121092 212797
8
00
01

10
11

01
11

01
01

00
10

11
10

11
00

01
10
10
00
10

11
01

10
11

00
11

01
00

11
11

00
00

10
01

00
01

10
00
8
11
11

11
00

01
11

10
10

10
11

01
01

00
01

10
00
8
01
00

11
00

00
01

11
01

01
01

10
11

10
01

11
11
8
00
01

11
11

11
10

00...

output:

1195044
1200199
1197106
1196075
1074983
1199168
1197106
1198137
1201230
1197106
1199168
1197106
1195044
1198137
1197106
1197106
1199168
1198137
1198137
1198137
1076014
1196075
1199168
1197106
1197106
1197106
1197106
1195044
1198137
1198137
1200199
1196075
1202261
1198137
1198137
1199168
1196075
1196...

result:

ok 10000 numbers

Test #10:

score: 0
Accepted
time: 217ms
memory: 10728kb

input:

10000 9 3 5 10
16
01
11

10
11

11
00

00
10

01
01

01
10

10
10

00
11

11
10

00
01

01
00

11
01

10
01

10
00

00
00

11
11
16
11
11

00
10

01
01

01
00

10
10

10
01

11
10

11
01

11
00

10
11

01
10

01
11

10
00

00
00

00
11

00
01
16
00
00

11
00

00
10

10
11

11
10

01
11

01
00

10
00...

output:

58
58
58
58
58
58
58
58
58
58
58
58
58
58
58
58
58
58
58
58
58
58
58
58
58
58
58
58
58
58
58
58
58
58
58
58
58
58
58
58
58
58
58
58
58
58
58
58
58
58
58
58
58
58
58
58
58
58
58
58
58
58
58
58
58
58
58
58
58
58
58
58
58
58
58
58
58
58
58
58
58
58
58
58
58
58
58
58
58
58
58
58
58
58
58
58
58
58
58
58
...

result:

ok 10000 numbers

Test #11:

score: 0
Accepted
time: 211ms
memory: 15332kb

input:

10000 366 23 191 94
10
10
10

11
11

10
01

11
01

00
10

10
00

01
11

11
10

00
11

10
11
9
00
00

00
01

11
00

11
10

01
10

11
11

10
11

01
11

00
10
12
11
01

01
00

00
11

00
00

11
10

01
11

11
11

00
10

00
01

10
10

01
01

01
10
9
11
01

01
01

00
10

10
11

11
10

01
10

11
00

11
11

...

output:

909
932
978
886
886
932
909
863
932
863
886
955
886
932
955
909
978
909
932
909
932
955
863
978
909
932
863
886
978
955
863
932
932
718
955
718
932
909
955
932
978
932
886
932
1024
932
932
932
1001
718
955
886
909
909
909
978
978
764
978
863
909
955
909
932
886
978
955
909
718
978
863
932
1001
1001
...

result:

ok 10000 numbers

Test #12:

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

input:

10000 2191 1820 866 884
6
11
00

10
10

01
11

00
11

11
10

11
11
6
00
01

01
10

10
10

00
10

00
11

11
10
8
01
11

11
00

10
11

11
01

01
01

01
10

10
00

01
00
9
10
10

11
01

10
00

01
10

11
11

11
00

01
00

01
11

01
01
7
01
10

00
01

10
11

11
00

00
00

11
10

10
10
7
01
10

00
10

00
...

output:

9189
8447
10179
11027
8341
9331
11099
12282
13625
7068
10055
11027
8447
12759
9313
11045
11911
11063
8341
11929
9225
8359
11027
8818
10179
9666
6609
10903
12759
11063
9295
10957
12777
12795
13625
6132
8377
9189
11823
9331
10179
13625
6609
13661
6609
8447
9738
9295
10091
10197
9331
8818
8818
13148
74...

result:

ok 10000 numbers

Test #13:

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

input:

10000 28320 11478 7950 9407
11
00
10

11
00

01
01

11
11

10
11

11
10

00
01

01
10

01
11

00
11

10
00
8
00
11

11
10

00
00

00
01

10
01

11
11

01
01

01
00
8
01
10

10
11

11
10

01
00

00
01

10
00

01
01

00
10
11
01
01

11
11

10
11

00
11

00
01

10
10

11
01

00
10

10
00

11
10

01
10
...

output:

116333
88955
91026
114876
108383
91026
98976
116333
87498
117790
92483
94554
92483
92483
116333
108383
95397
108383
100433
109840
108383
108383
92483
106926
125740
116333
100433
109840
122826
92483
100433
108383
109840
93940
95448
93940
106926
109840
106926
108383
100433
103347
87498
106926
101890
1...

result:

ok 10000 numbers

Test #14:

score: 0
Accepted
time: 194ms
memory: 11976kb

input:

10000 117597 92204 151077 56217
11
00
01

10
11

11
10

10
01

01
10

10
10

00
11

01
00

11
00

00
00

00
10
10
11
11

01
11

10
10

00
11

01
00

11
10

11
00

01
01

11
01

01
10
12
11
01

11
00

01
10

10
11

11
10

01
11

00
11

11
11

10
00

00
01

01
01

10
01
9
11
10

00
00

10
10

00
10

1...

output:

910488
926245
1038679
798054
879664
798054
777824
762067
705850
946475
762067
859434
890258
854271
795547
705850
946475
777824
741837
741837
951638
926245
705850
798054
966705
762067
1002692
1115126
890258
736674
834041
798054
762067
762067
741837
767230
854271
910488
890258
762067
741837
762067
910...

result:

ok 10000 numbers

Test #15:

score: 0
Accepted
time: 209ms
memory: 14168kb

input:

10000 18 3 22 7
9
11
11

00
10

00
11

01
00

10
00

10
10

01
01

00
00

10
01
9
10
11

01
01

10
01

11
00

11
10

00
01

00
10

10
10

01
00
9
11
00

11
01

01
11

10
01

10
10

11
10

01
01

00
00

01
00
6
01
10

11
10

10
11

00
10

00
11

00
00
8
10
10

11
11

11
01

10
01

01
11

00
00

11
10...

output:

75
75
72
66
78
69
61
78
49
69
66
72
72
58
72
69
69
75
72
48
78
72
72
81
78
66
64
54
81
75
69
78
54
69
69
75
51
51
52
75
81
69
69
42
72
69
75
72
57
72
78
66
69
81
75
69
75
66
72
75
72
69
48
75
78
78
75
72
54
63
54
78
78
52
72
72
72
81
78
69
72
75
75
69
84
69
55
75
49
69
72
58
66
54
72
54
52
52
78
72
...

result:

ok 10000 numbers

Test #16:

score: 0
Accepted
time: 211ms
memory: 15440kb

input:

10000 341 107 258 76
16
11
10

10
10

11
11

00
10

00
01

10
00

10
11

00
11

01
00

11
01

11
00

01
11

01
10

01
01

10
01

00
00
16
01
01

11
01

01
11

11
10

00
11

10
11

11
11

01
10

10
01

10
10

10
00

00
00

01
00

11
00

00
01

00
10
16
00
00

01
01

01
11

01
10

00
10

10
00

10
10
...

output:

1969
1969
1969
1969
1969
1969
1969
1969
1969
1969
1969
1969
1969
1969
1969
1969
1969
1969
1969
1969
1969
1969
1969
1969
1969
1969
1969
1969
1969
1969
1969
1969
1969
1969
1969
1969
1969
1969
1969
1969
1969
1969
1969
1969
1969
1969
1969
1969
1969
1969
1969
1969
1969
1969
1969
1969
1969
1969
1969
1969
...

result:

ok 10000 numbers

Test #17:

score: 0
Accepted
time: 214ms
memory: 14312kb

input:

10000 3533 2421 1496 554
16
10
01

01
01

10
10

11
01

00
01

11
11

11
00

01
10

10
00

01
11

10
11

00
11

01
00

11
10

00
10

00
00
16
10
00

00
11

11
10

00
01

10
10

01
01

10
11

10
01

00
10

01
10

00
00

01
00

11
00

11
01

01
11

11
11
16
11
10

01
00

10
10

00
10

11
01

10
11

11...

output:

19345
19345
19345
19345
19345
19345
19345
19345
19345
19345
19345
19345
19345
19345
19345
19345
19345
19345
19345
19345
19345
19345
19345
19345
19345
19345
19345
19345
19345
19345
19345
19345
19345
19345
19345
19345
19345
19345
19345
19345
19345
19345
19345
19345
19345
19345
19345
19345
19345
19345
...

result:

ok 10000 numbers

Test #18:

score: 0
Accepted
time: 198ms
memory: 15488kb

input:

10000 53387 143 17443 8885
13
01
00

10
00

00
01

00
10

11
01

11
00

01
01

11
11

01
10

01
11

10
01

10
10

10
11
5
01
01

01
10

11
00

00
01

10
00
5
11
00

10
10

00
10

10
11

10
00
7
01
10

00
10

11
00

11
11

00
01

10
00

11
01
3
10
01

00
11

01
10
7
01
00

10
10

00
00

10
00

01
10
...

output:

89703
88702
88702
88988
17872
89131
89703
89131
88988
88988
88845
88988
88845
89131
88845
89131
89703
88988
89131
71831
89417
88988
89417
88988
89131
89274
71259
89131
71259
89131
89274
89131
88988
89560
89131
89417
89417
88988
89274
88845
89417
89417
88988
89703
89131
88988
88988
88702
88845
88988
...

result:

ok 10000 numbers

Test #19:

score: 0
Accepted
time: 215ms
memory: 13964kb

input:

10000 899881 288707 9429 85695
16
11
11

11
01

11
00

11
10

10
00

10
11

00
01

10
01

01
10

10
10

00
10

01
11

01
01

00
00

01
00

00
11
16
01
11

00
10

00
01

00
00

10
11

01
01

11
11

11
01

11
00

10
10

00
11

01
10

01
00

11
10

10
01

10
00
16
10
11

00
00

10
10

01
01

10
01

01
...

output:

1599872
1599872
1599872
1599872
1599872
1599872
1599872
1599872
1599872
1599872
1599872
1599872
1599872
1599872
1599872
1599872
1599872
1599872
1599872
1599872
1599872
1599872
1599872
1599872
1599872
1599872
1599872
1599872
1599872
1599872
1599872
1599872
1599872
1599872
1599872
1599872
1599872
1599...

result:

ok 10000 numbers

Test #20:

score: 0
Accepted
time: 204ms
memory: 12068kb

input:

10000 125 12 13 9
9
00
00

10
10

01
01

01
00

00
11

10
11

01
11

00
10

10
01
11
01
01

11
11

01
10

10
11

00
10

10
10

10
00

00
11

10
01

00
00

01
11
6
10
11

11
11

11
00

01
00

10
00

00
11
6
11
10

10
01

00
01

10
10

00
10

01
00
7
10
01

10
00

10
11

10
10

01
00

01
11

01
01
7
1...

output:

214
232
179
187
189
202
185
226
211
165
196
214
208
208
226
235
199
217
205
235
205
193
214
235
226
205
205
214
223
171
205
217
184
168
162
217
184
190
213
196
187
180
196
177
214
217
223
196
205
196
223
205
223
226
202
180
253
196
208
205
217
223
196
217
171
214
165
205
232
214
202
223
187
205
226
...

result:

ok 10000 numbers

Test #21:

score: 0
Accepted
time: 222ms
memory: 14628kb

input:

10000 818 129 386 46
8
00
10

01
10

10
01

10
11

10
00

00
11

10
10

01
00
9
10
10

00
10

11
10

01
01

11
11

10
00

00
00

00
11

11
01
11
11
11

10
01

00
11

11
01

10
10

01
01

10
00

00
10

01
00

11
10

10
11
10
10
01

01
00

01
11

10
10

11
00

00
00

10
11

01
10

11
01

01
01
7
01
11...

output:

2069
2115
2336
2161
2069
2161
2078
2161
2115
2115
2115
1848
1729
2115
2290
2198
1977
2115
2336
2032
1508
2290
2115
2161
2161
2198
2253
2069
2115
2161
2069
1637
2032
1637
2244
1508
2115
1591
2115
2023
2207
2069
2078
1986
2115
2115
2161
2115
2161
2124
2198
2023
2161
2253
2069
1986
2161
1940
1894
2069
...

result:

ok 10000 numbers

Test #22:

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

input:

10000 8108 448 924 736
10
00
01

10
00

01
01

10
11

01
00

11
01

11
00

10
10

11
11

10
01
8
01
00

11
11

11
00

01
10

10
11

10
00

10
01

01
11
10
01
00

11
11

01
11

00
00

00
01

10
00

01
01

11
01

10
01

11
10
9
01
00

11
00

01
01

00
11

01
11

10
10

10
11

00
10

00
01
13
10
00

11...

output:

13092
12456
13956
13668
14724
13092
14852
12196
12484
13380
13668
12644
13380
12932
13092
12484
13220
14116
12196
12644
13220
12008
12484
12196
14404
12644
12772
13956
13348
13956
12168
12932
13668
12932
13220
14116
13668
13092
13092
13380
12196
13668
13060
12932
12644
13220
13668
13668
13540
12772
...

result:

ok 10000 numbers

Test #23:

score: 0
Accepted
time: 198ms
memory: 11988kb

input:

10000 3256 3797 14057 1066
8
00
11

11
11

11
10

00
00

01
00

11
01

10
01

11
00
10
00
11

11
00

01
01

01
11

11
01

10
10

11
11

00
00

01
00

10
01
10
11
01

10
11

01
01

00
11

00
01

01
10

11
11

10
10

01
00

10
01
11
10
11

11
01

00
01

10
00

01
10

01
00

11
11

10
10

11
00

00
11
...

output:

21085
24341
24866
28122
18412
21668
17829
20544
17288
26998
17288
22209
24341
22734
25932
21085
16763
17829
20544
19436
19478
24341
18953
17346
22209
22209
20544
24866
28122
18953
20544
21668
19494
20544
22151
26473
18428
20019
21668
20560
16222
23800
16763
27056
23800
22209
21085
20544
24866
23800
...

result:

ok 10000 numbers

Test #24:

score: 0
Accepted
time: 204ms
memory: 14556kb

input:

10000 248 8 17 9
16
00
01

10
11

10
10

01
10

11
00

00
11

11
11

01
11

10
01

01
01

10
00

11
01

11
10

00
10

00
00

01
00
16
00
11

00
00

01
10

00
01

11
10

11
01

10
11

11
00

10
01

10
00

11
11

00
10

01
00

01
01

01
11

10
10
16
00
00

00
10

10
01

11
11

01
01

10
00

01
00

11
...

output:

386
386
386
386
386
386
386
386
386
386
386
386
386
386
386
386
386
386
386
386
386
386
386
386
386
386
386
386
386
386
386
386
386
386
386
386
386
386
386
386
386
386
386
386
386
386
386
386
386
386
386
386
386
386
386
386
386
386
386
386
386
386
386
386
386
386
386
386
386
386
386
386
386
386
386
...

result:

ok 10000 numbers

Test #25:

score: 0
Accepted
time: 213ms
memory: 15884kb

input:

10000 1097 375 200 27
8
11
00

10
10

01
10

11
01

11
10

01
11

10
00

01
00
11
00
11

11
01

01
10

11
00

11
10

10
00

10
01

01
01

10
10

00
01

01
11
9
01
01

00
00

10
01

01
11

11
11

01
00

00
01

01
10

11
10
8
01
00

00
00

11
00

00
01

11
11

10
10

01
10

00
10
8
01
11

00
01

11
01...

output:

2674
2582
2355
2501
2007
2582
2126
2501
2128
2074
2474
2355
2501
2728
2555
2447
2555
2555
2701
2474
2474
2355
2701
2528
2728
2528
2501
2382
2328
2555
2501
2582
2301
2555
2528
2153
2328
2501
2328
2180
2301
2701
2501
2501
2755
2528
2501
2501
2328
2301
2555
2528
2528
2474
2328
2328
2155
2782
2555
2528
...

result:

ok 10000 numbers

Test #26:

score: 0
Accepted
time: 205ms
memory: 15416kb

input:

10000 5773 2030 4653 213
11
10
00

11
11

11
00

10
10

00
00

01
01

10
11

11
10

00
01

01
00

11
01
9
01
01

10
01

01
00

10
00

11
10

11
00

00
11

11
11

00
01
6
10
11

00
01

00
00

11
01

10
10

01
11
10
01
11

00
10

10
10

11
11

10
11

10
01

10
00

01
10

11
01

00
00
7
10
01

01
01

0...

output:

23354
22021
19352
20204
21382
19565
21595
21595
23412
22021
22447
23625
22021
24264
17368
19991
23625
22021
16729
21595
23412
23838
21595
22021
22021
22021
22021
23412
15125
24051
24264
22234
21595
20204
14486
8229
19139
19565
21382
19778
22021
17368
19565
17748
24051
22715
19081
23838
22928
19778
1...

result:

ok 10000 numbers

Test #27:

score: 0
Accepted
time: 219ms
memory: 14012kb

input:

10000 130699 26950 25810 4736
16
00
10

00
11

10
00

01
00

00
00

11
11

10
01

11
00

11
10

10
10

01
10

01
01

01
11

11
01

10
11

00
01
16
10
10

10
00

11
01

00
00

01
00

10
01

11
11

01
01

00
10

01
11

11
00

00
01

00
11

01
10

11
10

10
11
16
01
10

10
00

00
00

11
01

01
11

11
0...

output:

330463
330463
330463
330463
330463
330463
330463
330463
330463
330463
330463
330463
330463
330463
330463
330463
330463
330463
330463
330463
330463
330463
330463
330463
330463
330463
330463
330463
330463
330463
330463
330463
330463
330463
330463
330463
330463
330463
330463
330463
330463
330463
330463...

result:

ok 10000 numbers

Test #28:

score: 0
Accepted
time: 208ms
memory: 14708kb

input:

10000 885 76 14 3
16
00
10

11
10

01
00

11
00

00
01

01
01

10
01

00
11

11
01

10
00

10
11

11
11

01
11

01
10

10
10

00
00
16
01
01

00
00

11
01

00
01

11
11

11
10

01
10

10
10

01
11

10
11

00
11

10
01

11
00

00
10

01
00

10
00
16
01
10

11
01

01
00

00
00

11
10

00
11

01
01

10...

output:

1120
1120
1120
1120
1120
1120
1120
1120
1120
1120
1120
1120
1120
1120
1120
1120
1120
1120
1120
1120
1120
1120
1120
1120
1120
1120
1120
1120
1120
1120
1120
1120
1120
1120
1120
1120
1120
1120
1120
1120
1120
1120
1120
1120
1120
1120
1120
1120
1120
1120
1120
1120
1120
1120
1120
1120
1120
1120
1120
1120
...

result:

ok 10000 numbers

Test #29:

score: 0
Accepted
time: 220ms
memory: 14980kb

input:

10000 5002 383 290 96
16
10
11

01
10

00
10

01
11

10
00

00
01

00
00

11
01

00
11

11
00

01
00

10
01

10
10

01
01

11
11

11
10
16
11
00

10
01

00
10

00
00

11
10

00
01

01
11

00
11

01
10

10
10

10
11

10
00

11
01

11
11

01
01

01
00
16
01
11

11
00

01
01

10
11

10
00

00
11

11
11...

output:

7792
7792
7792
7792
7792
7792
7792
7792
7792
7792
7792
7792
7792
7792
7792
7792
7792
7792
7792
7792
7792
7792
7792
7792
7792
7792
7792
7792
7792
7792
7792
7792
7792
7792
7792
7792
7792
7792
7792
7792
7792
7792
7792
7792
7792
7792
7792
7792
7792
7792
7792
7792
7792
7792
7792
7792
7792
7792
7792
7792
...

result:

ok 10000 numbers

Test #30:

score: 0
Accepted
time: 211ms
memory: 15248kb

input:

10000 37886 3303 8387 818
12
01
11

00
01

01
10

00
00

10
10

11
10

01
01

00
10

00
11

01
00

11
00

10
00
10
01
00

00
00

11
01

10
00

11
00

01
10

11
10

00
10

01
01

00
01
10
01
00

11
11

00
00

00
10

11
01

11
00

01
10

10
01

10
00

10
10
6
11
11

00
11

00
10

10
00

01
10

11
10
8...

output:

71962
70326
67841
62902
66205
68690
67841
68659
59454
56151
54515
64538
67023
71144
68659
71962
71962
62084
67841
63720
64569
65387
70326
71962
71962
67023
71144
67841
62902
67023
67023
53697
71144
66205
68690
62053
63720
69477
65356
54515
69508
69508
53697
68659
71962
67841
63720
66205
65387
67023
...

result:

ok 10000 numbers

Test #31:

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

input:

10000 272023 75003 90381 5629
16
11
00

00
10

00
00

10
00

11
01

11
10

01
11

01
00

10
10

11
11

01
01

00
11

01
10

00
01

10
01

10
11
16
01
10

00
10

01
00

00
11

01
01

11
11

01
11

10
00

10
11

11
00

10
01

10
10

00
01

11
01

11
10

00
00
16
10
11

00
00

01
10

11
01

00
01

10
0...

output:

803458
803458
803458
803458
803458
803458
803458
803458
803458
803458
803458
803458
803458
803458
803458
803458
803458
803458
803458
803458
803458
803458
803458
803458
803458
803458
803458
803458
803458
803458
803458
803458
803458
803458
803458
803458
803458
803458
803458
803458
803458
803458
803458...

result:

ok 10000 numbers

Test #32:

score: 0
Accepted
time: 209ms
memory: 14544kb

input:

10000 1852 195 177 8
2
01
11

11
00
10
11
00

10
10

10
00

11
10

00
10

00
11

01
10

00
01

01
00

01
01
7
10
10

01
10

01
01

01
11

00
01

11
00

00
11
11
11
10

01
00

01
10

11
11

11
00

00
00

00
11

00
10

10
01

01
11

00
01
10
11
11

00
11

00
01

01
10

10
00

01
00

11
01

10
01

10
1...

output:

2055
2974
2789
2813
2813
2789
2618
2805
2805
2797
2644
2628
2781
2990
2821
2789
2797
2990
2256
2974
2417
2813
2781
2435
2612
2998
2612
2594
2813
2797
2813
2433
2797
2974
2974
2604
2612
2797
2620
2451
2628
2610
2604
2443
2781
2805
2586
2789
2805
2805
2612
2242
2425
2604
2620
2805
2797
2612
2789
2596
...

result:

ok 10000 numbers

Test #33:

score: 0
Accepted
time: 204ms
memory: 15604kb

input:

10000 17387 1490 1769 56
9
11
11

10
10

11
01

11
10

01
01

10
00

11
00

01
10

10
11
7
00
10

01
11

11
11

11
10

10
00

01
10

00
01
9
11
00

11
10

00
10

10
00

00
00

10
01

01
11

01
00

10
11
11
00
00

11
10

11
01

11
00

01
00

10
11

10
01

00
01

01
01

00
10

01
11
14
01
10

11
01

1...

output:

27053
24129
25563
27109
27277
20479
20758
24073
24129
25451
20702
27165
27053
21093
26997
20758
25507
23738
25619
25563
27109
26997
22248
25619
23961
25563
25563
24017
25507
25675
26941
25619
24073
25563
26941
24017
25787
27109
25619
25451
25563
25563
25507
22583
24017
25507
25563
25619
27053
20758
...

result:

ok 10000 numbers

Test #34:

score: 0
Accepted
time: 197ms
memory: 15780kb

input:

10000 191551 72 18085 987
9
01
11

10
01

00
11

10
00

00
01

01
00

11
00

01
01

10
10
11
00
10

01
01

11
01

01
11

01
10

10
01

11
00

10
11

00
00

00
01

11
10
9
11
00

01
11

00
11

11
01

11
10

00
00

01
00

10
00

11
11
9
01
10

00
01

01
01

00
00

11
01

11
10

01
00

10
10

10
00
8
1...

output:

228369
228369
210140
228225
228225
228585
228297
228081
228297
210212
210140
228513
228225
228225
228081
228369
228297
228153
228369
210212
228297
210140
228297
228153
228225
228225
228225
228225
228369
228153
228369
228153
228225
228153
228153
228513
228369
228369
228297
228153
228297
228081
228513...

result:

ok 10000 numbers

Test #35:

score: 0
Accepted
time: 201ms
memory: 15108kb

input:

10000 10118 316 340 3
6
01
11

11
10

01
00

10
11

11
11

00
11
8
10
01

10
11

01
00

01
10

11
11

00
00

01
01

11
00
6
11
10

11
01

10
00

10
11

01
00

00
01
8
10
10

00
00

00
11

11
11

00
10

11
00

10
01

10
00
10
00
00

01
11

01
01

01
10

11
01

10
01

01
00

10
00

11
11

00
11
12
11
...

output:

11099
11102
11096
11439
11758
11764
11755
11439
11764
11758
11758
11093
12068
11093
11752
11099
11439
11442
11436
11099
11439
10780
12077
11758
11436
11096
11096
12071
11412
11096
12071
11758
11755
11746
11439
11749
11752
11761
10780
12074
11758
11755
11755
11123
11442
11755
12071
11439
11758
11099
...

result:

ok 10000 numbers

Test #36:

score: 0
Accepted
time: 214ms
memory: 14528kb

input:

10000 17133 130 2295 53
11
11
10

00
01

00
00

01
11

00
11

10
01

01
01

11
00

10
10

10
00

11
11
8
11
01

01
00

00
01

00
00

10
10

11
00

10
01

00
10
7
10
01

11
01

11
00

10
10

00
01

11
11

01
10
13
11
11

11
01

00
01

01
00

10
10

01
10

10
00

10
01

00
00

10
11

00
11

01
01

01
...

output:

22431
22219
20001
22561
22325
19847
22325
21959
22089
22219
22142
22195
22142
22402
20030
22113
22561
19818
22113
22272
22272
22065
22325
22325
22296
22065
22012
22378
22455
19977
22272
17552
22195
22402
22142
22325
22378
22195
22455
22378
22325
22325
22508
22484
22455
20030
22089
22272
22219
22243
...

result:

ok 10000 numbers

Test #37:

score: 0
Accepted
time: 217ms
memory: 15668kb

input:

10000 92866 976 842 6
16
01
01

00
10

11
01

01
11

11
10

10
10

11
00

10
01

10
11

00
11

01
10

10
00

00
01

11
11

00
00

01
00
16
10
00

11
11

11
00

00
11

01
00

10
10

01
10

10
11

00
00

00
01

11
10

11
01

10
01

01
01

00
10

01
11
16
01
01

11
10

01
10

11
11

01
00

10
01

10
11...

output:

98240
98240
98240
98240
98240
98240
98240
98240
98240
98240
98240
98240
98240
98240
98240
98240
98240
98240
98240
98240
98240
98240
98240
98240
98240
98240
98240
98240
98240
98240
98240
98240
98240
98240
98240
98240
98240
98240
98240
98240
98240
98240
98240
98240
98240
98240
98240
98240
98240
98240
...

result:

ok 10000 numbers

Test #38:

score: 0
Accepted
time: 210ms
memory: 15208kb

input:

10000 794690 2954 9163 47
8
00
11

10
00

01
11

01
00

10
11

00
10

10
10

11
00
6
11
11

10
00

00
01

01
00

11
00

10
01
7
01
10

11
11

11
00

10
11

00
00

11
01

10
10
9
01
11

00
01

00
10

11
11

01
10

11
00

01
01

10
00

11
01
8
10
00

11
11

11
01

01
11

00
01

10
11

00
00

01
10
8
0...

output:

822019
819018
821972
822066
822019
824879
821972
803900
825067
809761
822066
819159
812903
822066
821925
821925
800739
824879
809808
809855
806854
809808
809808
822113
819159
822113
821925
818971
822113
819065
809949
816111
812809
822160
821972
819065
824879
819065
822019
819018
816017
822019
819159...

result:

ok 10000 numbers

Extra Test:

score: 0
Extra Test Passed