QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#761657#67. Two TransportationsUrd100 ✓273ms33272kbC++204.0kb2024-11-19 07:34:282024-11-19 07:34:30

详细

Subtask #1:

score: 6
Accepted

Test #1:

score: 6
Accepted
time: 14ms
memory: 3932kb

input:

1 1 1 1 1 1 1 1 1 -1
1 1 1 1 1 1 1 1 1 -1
1 1 1 1 1 1 1 1 1 -1
1 1 1 1 1 1 1 1 1 -1
1 1 1 1 1 1 1 1 1 -1
1 1 1 1 1 1 1 1 1 -1
1 1 1 1 1 1 1 1 1 -1
1 1 1 1 1 1 1 1 1 -1
1 1 1 1 1 1 1 1 1 -1
1 1 1 1 1 1 1 1 1 -1
1 1 1 1 1 1 1 1 1 -1
1 1 1 1 1 1 1 1 1 -1
1 1 1 1 1 1 1 1 1 -1
1 1 1 1 1 1 1 1 1 -1
1 1 1 ...

output:

-1
0 1 0 1 1 0 1 0 0 0 0 1 1 0 0 1 0 1 0 0 0 1 0 0 0 1 1 1 1 -1
1 0 1 0 1 1 0 1 1 0 1 0 0 0 0 1 1 0 0 1 -1
0 1 0 0 0 1 1 0 0 0 1 1 0 0 0 0 0 0 1 1 -1
1 0 1 1 0 0 1 0 1 0 0 0 0 1 0 1 1 0 1 1 -1
0 0 0 0 1 1 0 0 0 1 0 0 0 1 0 0 0 0 1 1 -1
0 0 1 0 0 0 1 0 0 0 1 0 0 0 1 0 0 0 1 1 -1
0 1 1 0 0 0 0 1 1 1 1...

input:


output:

0
2417
4435
3092
3018
2637
2136
3353
4117
2498
3522
3354
2776
1912
3232
3382
2310
2867
3546
2681
2605
3912
3045
3311
1307
2094
1352
3087
3487
3865
3223
4033
3647
2816
2468
1263
2756
3086
1735
3002
2385
2754
2837
3718
2891
2201
3478
3041
2726
3012
2634
2599
914
3509
4886
2317
4081
1993
2391
2749
3551...

result:

ok 2000 lines

Test #2:

score: 6
Accepted
time: 1ms
memory: 3824kb

input:

1 1 1 1 1 1 1 1 1 -1
-1
-1

output:

-1
1 1 1 1 1 1 1 1 1 -1
-1

input:


output:

0

result:

ok single line: '0'

Test #3:

score: 6
Accepted
time: 5ms
memory: 4004kb

input:

1 1 1 1 1 1 1 1 1 -1
1 1 1 1 1 1 1 1 1 -1
1 1 1 1 1 1 1 1 1 -1
1 1 1 1 1 1 1 1 1 -1
1 1 1 1 1 1 1 1 1 -1
1 1 1 1 1 1 1 1 1 -1
1 1 1 1 1 1 1 1 1 -1
1 1 1 1 1 1 1 1 1 -1
1 1 1 1 1 1 1 1 1 -1
1 1 1 1 1 1 1 1 1 -1
1 1 1 1 1 1 1 1 1 -1
1 1 1 1 1 1 1 1 1 -1
1 1 1 1 1 1 1 1 1 -1
1 1 1 1 1 1 1 1 1 -1
1 1 1 ...

output:

-1
1 0 1 0 0 0 0 1 0 1 0 0 1 1 0 0 1 0 0 0 1 1 1 1 0 0 0 1 1 -1
0 1 1 0 0 0 1 1 0 1 0 1 1 1 1 0 0 1 1 0 -1
0 1 0 1 1 1 0 0 1 1 0 1 0 1 0 1 0 1 0 1 -1
1 1 1 1 0 0 0 1 1 1 0 1 0 0 1 1 0 1 1 0 -1
1 0 1 1 0 1 0 0 0 0 0 1 0 1 1 0 1 0 0 1 -1
0 1 1 0 0 0 1 0 0 1 0 1 1 0 0 1 0 1 0 1 -1
1 1 1 0 0 1 1 0 1 0 0...

input:


output:

0
396305
456652
146790
45193
157298
290069
106100
444511
21734
496244
290946
448070
521134
597482
523834
252545
359818
556162
571923
74738
478958
576152
13164
3449
20598
191933
480791
549865
358479
85064
194758
230237
199091
240511
264959
272630
506097
508042
437901
345079
203449
238730
170044
35181...

result:

ok 2000 lines

Test #4:

score: 6
Accepted
time: 72ms
memory: 12828kb

input:

1 1 1 1 1 1 1 1 1 -1
1 1 1 1 1 1 1 1 1 -1
1 1 1 1 1 1 1 1 1 -1
1 1 1 1 1 1 1 1 1 -1
1 1 1 1 1 1 1 1 1 -1
1 1 1 1 1 1 1 1 1 -1
1 1 1 1 1 1 1 1 1 -1
1 1 1 1 1 1 1 1 1 -1
1 1 1 1 1 1 1 1 1 -1
1 1 1 1 1 1 1 1 1 -1
1 1 1 1 1 1 1 1 1 -1
1 1 1 1 1 1 1 1 1 -1
1 1 1 1 1 1 1 1 1 -1
1 1 1 1 1 1 1 1 1 -1
1 1 1 ...

output:

-1
0 0 0 0 0 0 1 1 0 0 0 0 0 1 0 0 1 0 1 1 0 0 0 0 0 0 0 1 1 -1
1 0 0 1 1 0 1 1 1 1 0 0 0 0 0 0 0 0 1 1 -1
0 0 1 1 0 0 1 0 0 0 0 0 0 0 0 0 0 1 1 1 -1
1 0 0 0 0 0 1 1 0 1 1 0 0 0 0 0 0 1 1 0 -1
0 1 1 0 1 1 0 0 0 0 0 0 0 0 0 0 0 0 1 0 -1
1 1 1 1 0 0 0 0 1 1 0 0 0 0 0 0 0 0 1 1 -1
0 0 0 1 1 0 0 1 1 1 1...

input:


output:

0
3448
958
4288
8681
336
148
3141
6232
8253
676
8417
4301
7395
2583
2332
1931
5600
7707
6421
1048
3951
3221
1394
6384
4563
4421
2439
5778
5223
3112
7250
7987
2207
564
5006
4104
2143
1953
2367
3895
5571
5608
8505
3836
8925
1735
5333
2756
2154
3381
4181
7200
9010
3640
5480
3088
5385
4089
2931
8673
454...

result:

ok 2000 lines

Test #5:

score: 6
Accepted
time: 3ms
memory: 4324kb

input:

1 1 1 1 1 1 1 1 1 -1
1 1 1 1 1 1 1 1 1 -1
1 1 1 1 1 1 1 1 1 -1
1 1 1 1 1 1 1 1 1 -1
1 1 1 1 1 1 1 1 1 -1
1 1 1 1 1 1 1 1 1 -1
1 1 1 1 1 1 1 1 1 -1
1 1 1 1 1 1 1 1 1 -1
1 1 1 1 1 1 1 1 1 -1
1 1 1 1 1 1 1 1 1 -1
1 1 1 1 1 1 1 1 1 -1
1 1 1 1 1 1 1 1 1 -1
1 1 1 1 1 1 1 1 1 -1
1 1 1 1 1 1 1 1 1 -1
1 1 1 ...

output:

-1
0 0 0 0 0 0 1 1 1 0 0 0 0 1 0 0 0 0 1 1 0 0 0 0 0 0 1 0 0 -1
0 0 0 0 0 1 0 0 1 0 1 0 0 0 0 0 0 0 1 0 -1
0 0 0 0 0 0 1 0 0 1 0 0 0 0 0 0 0 0 1 0 -1
0 0 0 0 1 0 1 1 0 1 0 0 0 0 0 0 0 0 1 1 -1
0 0 0 0 0 1 1 0 0 0 1 0 0 0 0 0 0 0 0 1 -1
0 0 0 0 0 0 0 0 1 1 1 0 0 0 0 0 0 0 0 1 -1
0 0 0 0 0 0 1 0 1 1 0...

input:


output:

0
45
26
35
27
44
28
19
40
28
26
24
33
56
20
33
32
45
13
24
29
34
20
30
35
52
33
35
22
45
32
42
29
33
35
53
35
11
53
28
28
44
32
46
39
39
56
87
36
18
28
37
38
40
52
36
36
33
36
32
36
26
30
37
31
38
43
7
50
24
48
40
37
48
37
27
37
43
47
43
32
31
31
43
35
40
51
37
45
37
15
25
34
40
34
23
34
38
33
54

result:

ok 100 lines

Test #6:

score: 6
Accepted
time: 21ms
memory: 5316kb

input:

1 1 1 1 1 1 1 1 1 -1
1 1 1 1 1 1 1 1 1 -1
1 1 1 1 1 1 1 1 1 -1
1 1 1 1 1 1 1 1 1 -1
1 1 1 1 1 1 1 1 1 -1
1 1 1 1 1 1 1 1 1 -1
1 1 1 1 1 1 1 1 1 -1
1 1 1 1 1 1 1 1 1 -1
1 1 1 1 1 1 1 1 1 -1
1 1 1 1 1 1 1 1 1 -1
1 1 1 1 1 1 1 1 1 -1
1 1 1 1 1 1 1 1 1 -1
1 1 1 1 1 1 1 1 1 -1
1 1 1 1 1 1 1 1 1 -1
1 1 1 ...

output:

-1
0 0 0 0 0 0 0 1 1 0 0 1 1 1 0 1 0 0 1 0 0 0 0 0 0 1 0 1 1 -1
1 0 1 1 0 0 1 0 0 1 1 0 0 0 0 0 0 1 0 0 -1
1 0 1 1 1 0 0 0 1 1 0 0 0 0 0 0 0 1 0 0 -1
1 1 1 0 0 0 1 1 0 1 0 0 0 0 0 0 0 0 1 0 -1
0 0 0 0 0 1 0 0 0 0 1 0 0 0 0 0 0 0 1 1 -1
1 0 0 0 1 0 1 1 1 1 1 0 0 0 0 0 0 0 1 0 -1
0 0 1 1 1 0 0 0 0 1 0...

input:


output:

0
170
114
124
149
133
109
128
102
102
129
94
138
137
50
153
93
92
127
100
145
136
112
155
172
104
114
132
136
140
139
111
135
24
74
117
99
115
107
87
138
96
76
174
132
110
101
134
128
99
93
82
128
94
102
97
123
160
116
151
104
84
98
220
145
126
144
74
132
148
81
103
138
161
133
88
81
127
122
167
102...

result:

ok 2000 lines

Subtask #2:

score: 8
Accepted

Test #7:

score: 8
Accepted
time: 1ms
memory: 3808kb

input:

1 1 1 1 1 1 1 1 1 -1
-1
-1

output:

-1
1 1 1 1 1 1 1 1 1 -1
-1

input:


output:

0

result:

ok single line: '0'

Test #8:

score: 8
Accepted
time: 3ms
memory: 3972kb

input:

1 1 1 1 1 1 1 1 1 -1
1 0 1 0 0 0 1 1 1 0 1 0 1 0 0 1 0 1 0 1 1 1 1 1 1 1 1 1 1 -1
0 1 0 0 0 0 1 1 1 1 0 0 1 0 0 1 1 0 0 1 1 1 1 1 1 1 1 1 1 -1
0 1 1 1 1 1 0 1 0 1 1 1 1 1 0 0 1 0 0 1 1 1 1 1 1 1 1 1 1 -1
1 0 0 1 1 1 0 0 0 1 0 0 1 0 1 0 1 0 1 1 1 1 1 1 1 1 1 1 1 -1
1 1 0 0 1 1 1 1 0 1 1 1 0 1 0 1 1 1...

output:

-1
0 1 1 0 1 0 1 0 1 0 0 1 0 0 1 1 1 0 0 0 1 1 1 1 1 1 1 1 1 -1
1 0 0 0 1 0 0 0 0 0 1 0 1 1 0 0 1 1 0 0 1 1 1 1 1 1 1 1 1 -1
1 1 1 1 0 0 1 0 0 1 0 1 0 0 1 0 0 1 0 1 1 1 1 1 1 1 1 1 1 -1
1 1 1 0 1 0 0 1 0 1 0 1 1 0 1 0 0 0 1 0 1 1 1 1 1 1 1 1 1 -1
1 0 1 0 0 0 0 0 1 1 1 1 1 0 1 0 1 1 1 0 1 1 1 1 1 1 1...

input:


output:

0
128264
331628
384182
208153
525372
572423
144082
259414
406719
308409
557889
129397
285792
216221
486927
571225
149599
317887
440746
229109
307465
104346
97136
445388
611196
462442
152511
595507
317479
409647
118010
508691
325383
250598
85753
552333
387494
470667
87406
390547
180339
101478
64178
2...

result:

ok 2000 lines

Test #9:

score: 8
Accepted
time: 0ms
memory: 3956kb

input:

0 1 1 1 1 1 1 0 1 -1
1 0 1 0 0 1 1 1 0 1 0 1 0 1 1 1 0 1 1 0 -1
1 1 1 1 0 1 1 1 1 -1
1 1 0 1 0 1 0 0 1 0 1 1 1 1 1 0 0 1 1 0 0 1 0 0 0 0 0 1 0 -1
0 0 1 0 1 0 1 0 1 0 1 0 1 1 0 1 1 0 1 0 -1
0 1 0 0 0 1 0 1 1 0 0 1 1 1 0 0 0 0 1 1 -1
0 1 0 1 0 0 1 1 1 -1
0 1 0 0 0 1 0 0 1 1 0 1 1 0 1 0 0 1 1 0 0 1 1 0...

output:

-1
1 1 1 1 1 1 1 1 1 -1
1 0 1 1 0 1 1 0 1 0 1 1 0 1 0 0 1 0 0 0 0 1 1 0 0 1 1 1 0 -1
1 1 0 0 1 0 0 1 1 0 0 1 1 1 1 1 1 1 1 1 -1
1 1 1 0 0 0 0 1 0 -1
1 0 1 0 0 0 0 0 0 -1
1 1 0 1 1 0 0 0 0 1 1 0 0 1 1 0 0 0 1 0 0 1 0 1 0 0 1 1 1 -1
0 1 0 0 1 1 1 1 0 0 0 1 1 1 1 1 1 1 1 1 -1
1 1 1 1 1 1 1 1 1 -1
1 1 1...

input:


output:

0
146596
486541
542861
502560
183150
412880
64845
101068
278420
276251
427456
76218
143112
209207
558065
307241
614514
208920
287802
355682
281972
181079
523222
206539
34041
323247
426483
47638
205160
104524
292282
131653
145869
480792
82385
485370
530341
131178
574749
543107
343884
191191
164986
35...

result:

ok 2000 lines

Test #10:

score: 8
Accepted
time: 133ms
memory: 9400kb

input:

0 0 0 0 0 0 0 0 1 -1
0 0 1 1 0 0 0 1 1 0 1 0 0 0 0 0 0 0 1 0 -1
1 0 0 0 1 0 1 1 1 1 0 0 0 0 0 0 0 0 0 1 -1
1 1 0 0 0 0 1 0 0 0 1 0 0 0 0 0 0 0 1 0 -1
1 0 0 1 1 0 0 0 0 0 1 0 0 0 0 0 0 0 0 1 -1
1 1 0 1 1 0 1 0 0 0 1 0 0 0 0 0 0 0 1 0 -1
0 1 0 0 0 1 1 1 0 1 1 0 0 0 0 0 0 0 1 0 -1
1 0 1 0 1 1 1 0 0 0 1...

output:

-1
1 1 1 1 1 1 1 1 1 -1
1 1 1 1 1 1 1 1 1 -1
1 1 1 1 1 1 1 1 1 -1
1 1 1 1 1 1 1 1 1 -1
1 1 1 1 1 1 1 1 1 -1
1 1 1 1 1 1 1 1 1 -1
1 0 0 0 0 0 1 1 1 -1
1 0 0 0 0 0 1 0 1 -1
1 0 0 0 0 0 0 1 1 -1
1 0 0 0 0 0 0 0 1 -1
1 0 0 0 0 0 0 0 0 -1
0 0 1 1 1 0 1 1 0 -1
0 0 1 1 1 0 1 0 0 -1
0 0 1 1 1 0 0 1 1 -1
0 0...

input:


output:

0
2248
1885
378
1566
1525
309
666
1857
2847
758
1494
2486
2597
2582
457
2369
1571
1189
2272
2264
1745
937
2057
98
2765
2333
1334
2953
192
2317
1318
825
2297
158
388
1256
1467
2758
1741
593
1760
1844
1051
745
1365
2911
2660
2563
2470
2722
2325
2300
1399
2410
2147
1061
2146
2642
541
2740
2138
38
2803
...

result:

ok 2000 lines

Test #11:

score: 8
Accepted
time: 132ms
memory: 9228kb

input:

0 0 0 0 0 0 0 1 1 -1
0 0 0 0 1 0 1 0 1 1 0 0 0 0 0 0 0 0 0 0 -1
0 0 0 0 1 0 1 0 1 0 1 0 0 0 0 0 0 0 0 1 -1
1 0 0 1 0 1 1 1 1 0 1 0 0 0 0 0 0 0 0 0 -1
1 0 0 0 1 1 0 1 1 1 1 0 0 0 0 0 0 0 0 1 -1
1 1 0 1 1 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 -1
1 0 0 0 1 1 0 0 0 1 0 0 0 0 0 0 0 0 0 0 -1
0 1 1 1 0 1 1 1 0 1 1...

output:

-1
1 1 1 1 1 1 1 1 1 -1
1 1 1 1 1 1 1 1 1 -1
1 1 1 1 1 1 1 1 1 -1
1 1 1 1 1 1 1 1 1 -1
1 1 1 1 1 1 1 1 1 -1
1 1 1 1 1 1 1 1 1 -1
1 1 1 1 1 1 1 1 1 -1
1 1 1 1 1 1 1 1 1 -1
1 1 1 1 1 1 1 1 1 -1
1 1 1 1 1 1 1 1 1 -1
1 1 1 1 1 1 1 1 1 -1
1 1 1 1 1 1 1 1 1 -1
1 1 1 1 1 1 1 1 1 -1
1 1 1 1 1 1 1 1 1 -1
1 1...

input:


output:

0
13
14
15
13
11
11
16
8
9
15
12
10
12
11
13
15
16
15
12
14
10
13
13
12
11
13
15
15
12
15
12
9
12
15
15
14
15
12
12
7
14
17
11
15
13
10
12
11
9
17
11
13
13
15
15
12
11
15
13
14
11
14
14
14
14
11
11
13
12
11
14
12
14
13
14
13
11
15
12
15
9
11
12
13
3
3
15
11
14
13
10
12
10
13
12
15
12
12
17
12
12
14
...

result:

ok 2000 lines

Test #12:

score: 8
Accepted
time: 4ms
memory: 3940kb

input:

1 1 1 1 1 1 1 1 1 -1
1 1 1 1 1 1 1 1 1 -1
1 1 1 1 1 1 1 1 1 -1
1 1 1 1 1 1 1 1 1 -1
1 1 1 1 1 1 1 1 1 -1
1 1 1 1 1 1 1 1 1 -1
1 1 1 1 1 1 1 1 1 -1
1 1 1 1 1 1 1 1 1 -1
1 1 1 1 1 1 1 1 1 -1
1 1 1 1 1 1 1 1 1 -1
1 1 1 1 1 1 1 1 1 -1
1 1 1 1 1 1 1 1 1 -1
1 1 1 1 1 1 1 1 1 -1
1 1 1 1 1 1 1 1 1 -1
1 1 1 ...

output:

-1
0 0 1 0 0 0 0 1 1 0 0 1 0 0 0 1 0 1 1 0 0 0 0 0 1 1 0 0 1 -1
0 0 1 1 0 0 1 0 0 0 1 0 0 0 1 0 0 0 0 0 -1
0 0 1 0 0 0 0 1 1 0 1 0 0 0 1 1 0 0 1 0 -1
0 0 0 1 1 0 0 0 1 1 0 0 0 0 0 0 0 0 1 1 -1
0 0 0 1 1 1 1 0 1 0 0 0 0 0 0 0 0 1 1 1 -1
0 0 1 0 1 0 0 1 1 1 1 0 0 0 0 1 0 1 1 1 -1
0 0 0 1 0 0 1 0 0 1 0...

input:


output:

0
588
828
680
367
984
784
697
790
734
680
803
1146
537
462
648
599
599
675
537
731
524
1264
746
741
427
729
1091
754
762
765
849
739
509
1152
519
631
626
330
941
851
643
456
1030
548
792
603
526
507
686
502
423
654
967
672
700
630
919
727
752
865
1175
541
615
660
757
668
674
746
669
716
722
656
773
...

result:

ok 411 lines

Test #13:

score: 8
Accepted
time: 140ms
memory: 9208kb

input:

0 0 0 0 0 0 0 1 0 -1
1 1 1 0 1 1 1 0 0 1 1 0 0 0 0 0 0 0 0 0 -1
0 0 0 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 1 -1
1 1 1 0 0 1 0 0 1 0 0 0 0 0 0 0 0 0 0 0 -1
1 0 0 0 0 0 0 0 0 1 1 0 0 0 0 0 0 0 0 0 -1
0 0 1 1 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 -1
0 0 0 1 1 0 1 1 1 1 0 0 0 0 0 0 0 0 0 1 -1
1 1 0 0 1 0 1 0 0 0 1...

output:

-1
0 0 1 0 1 1 1 1 1 -1
0 0 1 0 1 1 1 0 1 -1
0 0 1 0 1 1 1 0 1 -1
0 0 1 0 1 1 1 0 0 -1
0 0 1 0 1 1 1 0 0 -1
0 0 1 0 1 1 1 0 0 -1
0 0 1 0 1 1 1 0 0 -1
0 0 1 0 1 1 0 1 1 -1
0 0 1 0 1 1 0 1 1 -1
0 0 1 0 1 1 0 1 1 -1
0 0 1 0 1 1 0 1 1 -1
0 0 1 0 1 1 0 1 1 -1
0 0 1 0 1 1 0 1 1 -1
0 0 1 0 1 1 0 1 1 -1
0 0...

input:


output:

0
10
15
18
7
14
13
9
16
12
11
8
12
11
10
11
13
11
9
12
9
8
13
9
11
14
11
15
11
11
14
14
8
8
14
12
13
12
13
9
12
12
7
11
8
12
14
12
11
14
15
15
15
13
13
12
16
13
9
7
11
12
13
15
9
13
11
9
9
11
9
9
11
15
11
14
10
14
13
13
14
11
14
11
14
12
12
11
11
12
13
9
11
11
14
12
8
12
15
11
11
17
11
13
8
11
16
7
...

result:

ok 2000 lines

Subtask #3:

score: 8
Accepted

Test #14:

score: 8
Accepted
time: 14ms
memory: 4240kb

input:

1 0 0 1 1 1 0 0 1 -1
0 0 0 0 1 1 1 0 0 1 1 0 0 0 0 0 0 0 1 0 -1
0 1 1 0 0 1 0 0 1 1 1 0 0 1 0 0 1 1 0 1 -1
0 0 0 0 0 0 1 0 0 1 1 1 0 1 1 1 0 0 0 1 -1
1 0 0 1 1 0 1 1 1 -1
0 1 0 1 1 1 0 1 1 -1
0 1 0 0 0 1 1 0 0 -1
0 0 0 1 1 1 1 0 0 -1
0 0 0 0 0 1 1 0 1 1 1 0 0 0 0 1 0 0 0 1 0 0 0 0 1 1 1 0 1 -1
1 0 0...

output:

-1
1 1 0 1 0 0 1 0 1 -1
0 0 1 1 0 1 1 0 0 -1
0 0 1 1 0 1 0 1 0 -1
0 0 0 0 1 1 1 0 1 0 1 1 1 1 1 1 0 1 0 1 0 0 1 1 1 1 1 0 0 -1
0 1 1 1 0 1 1 0 0 1 1 0 0 0 1 0 1 1 1 1 -1
1 1 1 0 1 1 1 0 1 1 1 0 0 1 0 1 0 0 0 0 -1
1 1 0 0 0 1 0 1 0 1 1 0 0 0 1 0 1 1 1 1 -1
1 1 0 1 1 0 1 0 0 0 1 0 0 0 1 0 1 1 1 1 -1
0...

input:


output:

0
3328
4161
4895
4209
3745
3720
4315
3313
4008
2104
3319
3666
3501
3499
3359
4244
3853
1906
392
2028
3840
3209
2376
3001
5530
2494
3340
5583
3653
3624
3798
4121
2243
4252
2165
4289
2935
6032
5124
5255
1362
3336
5054
4411
6329
4444
2299
2294
3848
5170
3200
1544
3953
3577
5969
6227
3533
4569
2619
2738...

result:

ok 2000 lines

Test #15:

score: 8
Accepted
time: 1ms
memory: 4076kb

input:

1 1 1 1 1 1 1 1 1 -1
-1
-1

output:

-1
1 1 1 1 1 1 1 1 1 -1
-1

input:


output:

0

result:

ok single line: '0'

Test #16:

score: 8
Accepted
time: 16ms
memory: 3984kb

input:

1 1 1 1 1 1 1 1 1 -1
1 1 1 1 1 1 1 1 1 -1
1 1 1 1 1 1 1 1 1 -1
1 1 1 1 1 1 1 1 1 -1
1 1 1 1 1 1 1 1 1 -1
1 1 1 1 1 1 1 1 1 -1
1 1 1 1 1 1 1 1 1 -1
1 1 1 1 1 1 1 1 1 -1
1 1 1 1 1 1 1 1 1 -1
1 1 1 1 1 1 1 1 1 -1
1 1 1 1 1 1 1 1 1 -1
1 1 1 1 1 1 1 1 1 -1
1 1 1 1 1 1 1 1 1 -1
1 1 1 1 1 1 1 1 1 -1
1 1 1 ...

output:

-1
0 1 1 1 1 1 1 1 1 1 1 1 1 1 0 0 0 1 0 0 1 0 0 1 0 0 1 1 0 -1
0 1 1 1 0 1 0 0 1 0 1 0 1 1 0 1 0 0 0 1 -1
0 1 1 1 0 1 1 1 0 1 1 1 1 0 1 1 0 0 1 1 -1
1 1 0 0 1 0 0 0 0 1 1 1 0 0 0 1 0 0 1 1 -1
0 0 1 1 0 0 1 1 1 0 0 1 1 1 0 1 0 0 1 1 -1
1 0 1 0 0 1 0 1 1 0 0 0 1 1 0 0 1 1 0 1 -1
1 1 0 1 1 0 1 1 1 0 1...

input:


output:

0
420095
382175
509921
251026
97715
238846
582051
440618
401236
668505
332409
339604
630991
450227
618117
91474
111467
396176
638878
86342
32030
39186
177499
198185
638627
316719
685545
267921
257514
32999
384278
438055
143240
475495
429277
386670
9132
346857
425602
608281
665431
356764
240342
21847...

result:

ok 2000 lines

Test #17:

score: 8
Accepted
time: 10ms
memory: 3944kb

input:

1 1 1 1 1 1 1 1 1 -1
1 0 0 0 0 1 0 1 1 0 1 0 1 1 0 1 1 1 0 1 1 1 1 1 1 1 1 1 1 -1
1 0 1 0 1 0 0 0 0 0 0 0 0 0 1 1 1 0 1 1 1 1 1 1 1 1 1 1 1 -1
0 1 1 0 1 0 0 0 0 1 1 1 1 0 0 1 0 1 0 0 1 1 1 1 1 1 1 1 1 -1
1 1 1 0 1 0 0 1 1 1 0 0 1 1 1 0 1 1 1 1 1 1 1 1 1 1 1 1 1 -1
0 0 1 1 0 1 0 1 0 1 1 1 0 0 1 0 0 1...

output:

-1
0 1 1 1 0 0 1 1 0 0 1 0 1 1 0 0 1 1 0 1 1 1 1 1 1 1 1 1 1 -1
0 1 0 0 1 0 0 0 1 1 1 1 0 1 0 0 0 0 0 1 1 1 1 1 1 1 1 1 1 -1
1 0 0 1 1 0 1 1 0 1 1 0 0 1 1 1 0 0 0 1 1 1 1 1 1 1 1 1 1 -1
0 0 1 1 0 1 0 0 1 1 1 0 0 0 1 1 0 1 0 1 1 1 1 1 1 1 1 1 1 -1
0 0 1 1 0 1 0 0 0 0 1 0 1 1 0 0 1 0 0 1 1 1 1 1 1 1 1...

input:


output:

0
486976
292504
384824
89034
22181
51475
112344
391024
279353
199893
443977
146688
236693
252403
355708
145471
28557
154925
61393
3336
359136
96707
466370
33119
59085
185807
390418
417968
247670
175096
487863
165768
148205
479326
490958
159150
189607
186855
409454
225537
153935
462155
306191
237849
...

result:

ok 2000 lines

Test #18:

score: 8
Accepted
time: 9ms
memory: 3912kb

input:

1 0 1 0 1 0 0 1 1 -1
0 0 1 0 1 1 1 0 1 0 1 1 1 1 1 1 1 1 1 1 -1
1 1 1 1 0 0 1 0 0 0 0 0 0 0 0 0 1 0 1 1 1 1 1 1 1 1 1 1 1 -1
1 0 0 0 1 0 0 1 1 1 1 0 0 0 1 1 0 1 0 0 1 1 1 1 1 1 1 1 1 -1
1 0 1 0 0 0 1 1 0 1 1 1 1 0 1 0 0 1 1 0 1 1 1 1 1 1 1 1 1 -1
0 1 0 0 0 1 0 1 1 1 1 0 0 0 0 1 0 0 1 1 1 1 1 1 1 1 1...

output:

-1
1 1 1 1 1 1 1 1 1 -1
1 1 0 1 0 0 1 0 1 0 0 1 1 1 0 1 0 0 0 1 1 1 1 1 1 1 1 1 1 -1
1 0 1 1 1 1 0 0 1 0 1 1 0 1 0 1 0 0 0 0 1 1 1 1 1 1 1 1 1 -1
1 0 0 1 0 1 1 0 0 0 1 1 0 1 1 1 1 1 0 1 1 1 1 1 1 1 1 1 1 -1
1 1 0 1 0 0 1 1 0 1 1 0 0 0 1 0 0 0 0 1 1 1 1 1 1 1 1 1 1 -1
1 1 1 1 0 0 1 0 1 1 0 1 0 1 0 1 ...

input:


output:

0
365078
342852
29505
156415
26644
338913
507583
429124
7407
172414
1244
198614
271814
162933
463244
601112
243404
68261
362903
590980
66266
586427
377658
477630
268802
260412
559187
382183
36692
198911
538390
521952
97685
389466
401004
583925
473508
487269
5160
165992
165628
327510
447275
375876
33...

result:

ok 2000 lines

Test #19:

score: 8
Accepted
time: 3ms
memory: 3972kb

input:

1 0 1 0 0 1 1 0 1 -1
0 0 1 0 1 1 0 1 0 0 0 1 1 1 1 1 1 1 1 1 -1
1 1 1 1 1 1 1 1 1 -1
1 1 1 0 1 1 0 0 1 0 0 1 1 0 0 1 1 1 1 0 1 1 1 1 0 1 1 1 1 -1
0 1 0 1 1 1 0 0 1 0 0 1 1 1 1 1 1 1 1 1 -1
1 0 1 1 1 0 1 0 0 0 0 0 0 1 0 1 1 1 1 1 1 0 1 0 1 1 1 0 0 -1
0 1 0 0 1 0 0 0 0 0 1 1 1 1 1 1 1 1 1 1 -1
1 1 1 1...

output:

-1
1 1 1 1 1 1 1 1 1 -1
1 0 1 1 0 1 0 1 1 1 0 1 0 1 0 1 0 1 1 1 1 1 0 0 1 0 1 1 1 -1
1 1 0 1 1 0 0 1 1 1 0 1 1 1 1 1 1 1 1 1 -1
1 1 1 1 1 1 1 1 1 -1
0 1 1 1 0 1 1 0 1 1 1 1 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 1 -1
1 1 1 1 1 1 1 1 1 -1
1 0 0 1 1 0 0 0 0 0 1 1 1 1 0 0 0 0 1 1 0 1 1 0 1 0 0 0 1 -1
1 0 1 1 ...

input:


output:

0
679257
21614
148271
91891
235952
563409
565396
323574
223937
247248
267673
455787
362081
503066
427510
426547
181721
77274
188736
544956
302613
317658
43880
14610
446238
293169
277824
249155
688796
412429
465375
361701
246688
654178
107179
151031
528289
108258
301967
609313
177025
156275
499623
34...

result:

ok 2000 lines

Test #20:

score: 8
Accepted
time: 5ms
memory: 3920kb

input:

1 0 1 0 1 1 0 0 0 -1
1 0 1 0 1 0 1 0 1 -1
1 0 1 0 1 0 0 1 1 -1
1 0 1 0 1 0 0 0 0 -1
1 0 1 0 0 1 1 0 0 -1
1 0 1 0 0 1 0 1 0 -1
1 0 1 0 0 1 0 0 0 -1
1 0 1 0 0 0 1 1 0 -1
1 0 1 0 0 0 0 1 1 -1
1 0 1 0 0 0 0 1 0 -1
1 0 0 1 1 1 1 1 1 -1
1 0 0 1 1 1 0 1 1 -1
1 0 0 1 1 1 0 1 0 -1
1 0 0 1 1 0 1 1 0 -1
1 0 0 ...

output:

-1
0 0 0 0 0 0 0 1 1 1 1 0 0 1 0 0 0 0 0 1 0 0 0 0 0 0 0 1 0 -1
1 1 0 1 0 0 1 0 0 1 1 0 0 0 0 0 0 0 1 1 -1
1 1 1 0 1 0 1 1 1 1 1 0 0 0 0 0 0 1 0 0 -1
0 1 1 1 1 1 1 0 1 0 0 0 0 0 0 0 0 0 1 0 -1
0 0 0 0 1 0 1 1 0 0 1 0 0 0 0 0 0 0 1 0 -1
0 1 0 0 1 0 0 1 0 0 1 0 0 0 0 0 0 0 1 0 -1
1 1 0 1 0 0 0 0 0 0 1...

input:


output:

0
470
68166
346577
812
174818
251614
290070
607
86963
420585
344245
146305
144
1194
125990
723
373
257098
288493
311284
1036
145656
824
583779
559060
390356
514187
218593
363566
133428
574431
497678
239838
863
89692
203928
295730
91880
791
822
94217
1233
118856
316546
404063
297009
585432
177265
579...

result:

ok 2000 lines

Test #21:

score: 8
Accepted
time: 12ms
memory: 3984kb

input:

0 0 0 0 0 0 0 1 0 -1
1 0 1 0 1 0 1 0 0 1 1 0 0 0 0 0 0 0 0 0 -1
0 0 1 1 0 0 0 0 1 1 0 0 0 0 0 0 0 0 0 1 -1
0 1 0 0 1 1 1 1 0 1 0 0 0 0 0 0 0 0 0 0 -1
0 1 0 0 0 1 0 0 0 1 1 0 0 0 0 0 0 0 0 0 -1
0 0 1 0 1 0 1 0 0 0 1 0 0 0 0 0 0 0 1 0 -1
0 0 0 0 0 0 0 0 1 -1
0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 1 1 0 0 0 0 0...

output:

-1
0 0 0 0 0 1 0 0 0 -1
0 0 0 0 0 0 1 1 0 -1
0 0 0 0 0 0 1 1 0 -1
0 0 0 0 0 0 0 1 0 -1
0 0 0 0 0 0 0 1 0 -1
0 0 0 0 0 0 0 0 1 1 1 0 1 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 1 -1
1 0 0 0 0 0 0 1 1 0 1 0 0 0 0 0 0 0 1 1 -1
0 0 0 0 0 0 0 1 0 -1
0 0 0 0 0 0 0 0 1 1 0 0 1 0 1 0 0 1 1 1 0 0 0 0 0 0 0 0 1 -1
0 0 0 ...

input:


output:

0
11
3625
708623
496152
61478
530530
677072
130674
675392
711777
402653
707297
165308
662060
537996
555130
762258
316379
36
318492
27
120495
35
619832
495796
682403
677498
237070
335939
406876
315177
136626
119723
441102
293778
250715
531425
547515
451243
632926
190193
629994
38
332267
581880
380146...

result:

ok 2000 lines

Test #22:

score: 8
Accepted
time: 4ms
memory: 4264kb

input:

1 1 1 0 0 0 0 0 1 -1
1 1 0 1 1 1 1 0 1 -1
1 1 0 1 1 0 1 1 1 -1
1 1 0 1 1 0 0 0 0 -1
1 1 0 1 0 1 0 1 1 -1
1 1 0 1 0 0 1 0 0 -1
1 1 0 1 0 0 0 1 0 -1
1 1 0 0 1 1 1 0 1 -1
1 1 0 0 1 1 0 0 0 -1
1 1 0 0 1 0 0 1 0 -1
1 1 0 0 0 1 1 1 0 -1
1 1 0 0 0 1 0 0 1 -1
1 1 0 0 0 0 0 1 0 -1
1 0 1 1 1 1 1 0 0 -1
1 0 1 ...

output:

-1
0 0 0 0 0 0 1 0 0 1 0 1 1 1 0 0 1 1 0 0 0 0 0 0 0 0 1 1 0 -1
0 1 0 0 0 1 0 0 1 1 0 0 0 0 0 0 0 1 1 1 -1
1 0 0 1 0 1 1 0 1 1 0 0 0 0 0 0 0 1 0 1 -1
0 1 0 1 1 1 0 1 0 1 1 0 0 0 0 0 0 1 1 1 -1
0 1 0 0 0 0 1 1 1 1 0 0 0 0 0 0 0 0 1 0 -1
0 0 1 1 1 0 0 1 0 0 1 0 0 0 0 0 0 1 0 1 -1
1 1 0 0 0 1 1 0 1 1 0...

input:


output:

0
3897
8927
7309
1268
4357
8443
8672
1849
7627
7739
205
1431
3408
7984
2882
6475
3397
1841
4974
5752
4700
6061
1266
6696
6171
2130
893
6880
1764
5820
1062
6738
7332
8870
145
8338
8243
4309
6244
4444
6068
5273
4420
1819
8001
5485
2427
6217
3184
7653
5865
641
5266
1520
511
6331
2925
4898
3809
2994
437...

result:

ok 2000 lines

Test #23:

score: 8
Accepted
time: 16ms
memory: 4004kb

input:

1 1 1 1 1 1 1 1 1 -1
1 0 0 0 0 1 0 0 1 -1
1 0 0 0 0 1 0 0 0 -1
1 0 0 0 0 1 0 0 0 -1
1 0 0 0 0 1 0 0 0 -1
1 0 0 0 0 1 0 0 0 -1
1 0 0 0 0 0 1 1 1 -1
1 0 0 0 0 0 1 1 1 -1
1 0 0 0 0 0 1 1 0 -1
1 0 0 0 0 0 1 1 0 -1
1 0 0 0 0 0 1 1 0 -1
1 0 0 0 0 0 1 1 0 -1
1 0 0 0 0 0 1 0 1 -1
1 0 0 0 0 0 1 0 1 -1
1 0 0 ...

output:

-1
0 0 0 1 1 0 0 0 1 0 1 0 0 1 0 0 0 0 1 1 0 0 0 0 0 0 0 0 1 -1
1 1 0 1 1 1 1 0 1 1 1 0 0 0 0 0 0 0 0 0 -1
1 1 0 0 0 0 1 1 0 1 0 0 0 0 0 0 0 0 0 0 -1
0 1 0 0 1 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 -1
0 0 1 0 1 0 1 0 0 1 0 0 0 0 0 0 0 0 0 1 -1
1 0 1 1 0 0 0 1 1 1 1 0 0 0 0 0 0 0 0 0 -1
0 0 1 0 1 0 1 0 0 0 0...

input:


output:

0
121
113
162
63
128
144
500
53
486
357
495
155
118
282
403
154
272
270
85
52
505
467
169
121
386
477
392
351
295
222
549
113
292
313
207
326
210
321
213
330
102
275
71
346
388
96
122
318
263
479
280
103
260
210
235
168
274
406
301
438
393
293
410
87
310
54
426
186
185
126
478
128
532
292
518
386
21...

result:

ok 2000 lines

Subtask #4:

score: 38
Accepted

Test #24:

score: 38
Accepted
time: 6ms
memory: 3948kb

input:

1 1 1 1 1 1 1 1 1 -1
1 1 1 1 1 1 1 1 1 -1
1 0 0 1 0 1 0 1 1 -1
0 1 1 1 1 0 1 1 0 0 0 0 1 0 0 0 1 0 0 1 1 1 0 0 1 1 1 0 0 -1
0 0 1 1 0 0 1 0 0 -1
0 0 1 0 1 0 0 0 1 -1
0 0 0 0 0 0 1 1 1 0 1 1 0 0 0 1 1 0 1 1 0 0 0 0 0 1 1 1 0 -1
0 0 0 1 0 0 0 0 1 1 0 0 0 1 1 1 0 0 1 0 -1
0 0 0 0 1 1 0 1 1 0 0 1 1 1 1 ...

output:

-1
0 1 0 0 1 0 0 1 1 0 0 1 1 0 0 1 0 0 0 1 0 1 1 1 0 1 1 1 0 -1
0 0 0 0 1 1 0 0 1 1 0 0 0 0 1 1 0 1 0 1 -1
0 0 0 1 0 1 0 1 1 1 0 1 0 0 0 0 1 0 1 1 -1
0 0 0 0 1 0 1 0 1 0 0 0 0 0 1 1 1 0 0 1 0 0 0 0 1 0 0 1 1 -1
0 1 1 0 1 1 0 0 0 1 1 0 0 0 1 1 1 1 0 0 -1
0 1 0 0 0 1 0 0 0 0 1 0 0 0 1 0 1 1 0 0 -1
0 0...

input:


output:

0
1881
1737
1168
3083
3390
3240
1917
2761
3069
1616
1782
2120
1261
1381
1964
2536
2081
2469
1905
1175
2320
3849
2144
3819
2474
1769
3175
2218
3112
2407
2562
1266
1923
2468
1811
2501
2161
3587
1380
1928
2050
1753
2438
2193
2729
3206
3721
1096
1643
3010
2372
2816
3461
2515
2578
2019
705
2094
2798
1525...

result:

ok 900 lines

Test #25:

score: 38
Accepted
time: 8ms
memory: 3844kb

input:

0 0 1 1 1 1 0 1 1 -1
0 0 1 1 1 0 1 0 0 -1
0 0 1 1 1 0 0 0 1 -1
0 0 1 1 0 1 0 1 1 -1
0 0 1 1 0 0 1 1 0 -1
0 0 1 0 1 1 1 1 1 -1
0 0 1 0 1 1 0 0 1 -1
0 0 1 0 1 0 1 0 1 -1
0 0 1 0 0 1 1 0 1 -1
0 0 1 0 0 0 1 0 1 -1
0 0 1 0 0 0 0 1 1 -1
0 0 1 0 0 0 0 1 0 -1
0 0 0 1 1 1 0 0 1 -1
0 0 0 1 1 0 0 0 0 -1
0 0 0 ...

output:

-1
0 0 0 0 0 0 1 1 1 0 0 0 0 1 0 1 1 0 0 0 0 0 0 0 0 0 0 1 1 -1
0 1 0 0 0 1 1 0 0 0 1 0 0 0 0 0 0 1 1 0 -1
0 1 0 1 1 1 0 0 1 0 1 0 0 0 0 0 0 1 0 1 -1
0 0 1 1 1 1 1 0 1 1 0 0 0 0 0 0 0 1 1 1 -1
0 1 1 0 0 0 1 0 1 0 1 0 0 0 0 0 0 1 1 0 -1
0 0 1 0 1 0 1 0 1 1 1 0 0 0 0 0 0 1 0 0 -1
0 0 0 1 0 1 1 1 0 1 1...

input:


output:

0
102
1819
640
785
3114
1460
1485
3249
2366
1600
629
2885
2097
2674
1950
3906
2266
3967
3495
2248
2822
3860
66
753
1648
4184
2735
807
2201
538
1711
3818
4350
1696
271
3801
2955
1175
3933
3620
913
2200
1439
2758
835
1547
1668
201
1805
3773
2654
907
3408
3704
4150
3022
1121
3613
2341
1261
2363
2718
42...

result:

ok 900 lines

Test #26:

score: 38
Accepted
time: 64ms
memory: 11032kb

input:

0 0 0 0 0 0 0 1 1 -1
0 1 1 0 0 0 1 1 0 1 0 0 0 0 0 0 0 1 0 0 -1
0 1 1 0 0 1 1 1 0 1 0 0 0 0 0 0 0 1 1 0 -1
0 0 1 1 1 1 0 0 0 1 1 0 0 0 0 0 0 1 0 1 -1
0 0 0 1 0 0 1 1 0 1 0 0 0 0 0 0 0 0 0 1 -1
0 0 1 1 0 1 0 1 0 0 1 0 0 0 0 0 0 1 1 0 -1
0 0 0 0 0 1 0 0 1 1 1 0 0 0 0 0 0 0 1 0 -1
0 0 0 1 0 1 1 0 0 1 0...

output:

-1
0 0 0 1 0 0 1 1 0 -1
0 0 0 1 0 0 0 1 1 -1
0 0 0 0 1 1 1 1 1 -1
0 0 0 0 1 1 0 0 1 -1
0 0 0 0 1 0 1 0 0 -1
0 0 0 0 1 0 1 0 0 -1
0 0 0 0 0 1 1 1 0 -1
0 0 0 0 1 1 1 0 0 -1
0 0 0 0 1 0 1 1 1 -1
0 0 0 0 1 0 0 0 1 -1
0 0 0 0 0 1 1 1 0 -1
0 0 0 0 1 0 0 0 1 -1
0 0 0 0 0 1 1 1 0 -1
0 0 0 0 0 1 0 0 1 -1
0 0...

input:


output:

0
958
1664
390
858
3011
2944
682
2574
1091
1742
1661
443
458
2289
2450
2952
1189
2633
1799
1260
1162
1773
270
496
2428
1648
1741
1123
123
121
1238
2459
301
1317
2011
158
735
1351
25
1794
3034
876
2345
1558
613
2422
1681
2995
813
1299
2437
187
494
2734
2347
3053
975
674
1525
535
79
812
487
2017
2149
...

result:

ok 900 lines

Test #27:

score: 38
Accepted
time: 8ms
memory: 4192kb

input:

1 1 1 1 0 0 0 1 1 -1
1 0 1 0 0 1 0 0 1 -1
1 1 0 1 0 0 1 0 1 -1
1 1 1 0 1 0 1 1 1 -1
1 0 1 0 0 0 1 1 0 -1
1 0 1 1 1 1 1 0 1 -1
1 0 1 0 0 0 1 0 0 -1
1 1 1 0 0 0 1 1 1 -1
0 1 1 1 1 0 1 1 1 -1
1 1 1 1 0 1 0 0 0 -1
1 1 1 1 0 1 0 1 0 -1
1 1 1 0 0 1 0 0 1 -1
1 0 0 0 1 0 1 1 1 -1
1 1 1 0 1 0 1 0 1 -1
1 1 1 ...

output:

-1
1 0 1 0 0 1 1 0 0 0 0 0 1 0 1 0 1 1 1 1 1 0 0 1 1 0 1 0 1 -1
0 1 1 0 0 0 1 0 0 1 0 1 0 1 1 0 1 0 1 0 -1
0 0 1 1 0 1 0 1 0 1 1 1 1 0 1 0 1 0 0 0 -1
0 0 0 1 0 0 0 0 0 1 1 0 1 1 1 1 0 0 1 0 -1
0 1 0 1 0 1 0 1 0 1 0 1 0 0 0 1 0 0 0 0 -1
0 0 1 1 0 1 0 0 0 1 0 1 0 0 1 0 0 1 0 1 -1
0 0 0 1 1 0 1 0 1 1 0...

input:


output:

0
218908
99957
228474
201934
283938
95330
71505
284830
48108
72755
157670
174806
63619
82171
50613
216342
128546
92374
115678
212495
19614
173452
182243
239168
171023
16304
300686
7352
39208
271252
166242
192010
54190
261551
137895
44491
165463
306440
65636
149301
257570
87294
88051
198315
53539
796...

result:

ok 900 lines

Test #28:

score: 38
Accepted
time: 54ms
memory: 9176kb

input:

0 0 0 1 0 1 0 0 1 -1
0 0 0 0 0 0 1 1 0 0 1 1 1 0 0 0 0 0 1 1 0 0 0 0 1 0 1 0 0 -1
0 0 0 0 0 0 1 0 1 0 0 1 1 0 1 1 1 0 0 0 0 0 0 0 0 1 0 1 1 -1
0 0 0 0 0 0 0 0 1 0 1 0 0 0 0 1 0 0 0 1 0 0 0 1 0 0 0 0 0 -1
0 0 0 0 0 0 1 0 1 0 1 1 0 1 0 1 1 0 0 1 0 0 0 0 1 1 0 0 1 -1
0 0 0 0 0 0 0 1 1 0 0 1 0 1 0 0 0 1...

output:

-1
0 0 0 0 0 0 0 1 1 0 1 0 1 0 1 1 0 0 1 1 0 0 0 1 1 0 1 1 0 -1
0 0 0 0 0 0 1 0 0 0 1 1 0 0 0 0 0 0 1 0 0 0 0 0 1 1 1 0 1 -1
0 0 0 0 0 0 1 1 1 0 1 0 0 1 0 0 0 0 1 0 0 0 0 0 0 1 0 1 1 -1
0 0 0 0 0 0 0 1 0 0 1 1 0 1 1 1 0 1 1 0 0 0 0 0 1 1 1 0 1 -1
0 0 0 0 0 0 1 1 0 0 0 1 1 1 1 0 0 1 0 0 0 0 0 0 0 1 1...

input:


output:

0
883
2383
2370
2113
1520
666
3408
1994
482
3477
1876
467
1795
2951
2939
535
530
2433
550
1702
2607
2381
2425
847
3032
1293
1375
2847
43
3361
1828
2224
1744
1169
766
2704
1799
2100
1657
1676
3043
3186
803
3293
788
1564
2884
1602
3199
257
3314
228
121
272
93
1568
1641
429
1195
1364
1640
80
2077
979
9...

result:

ok 900 lines

Test #29:

score: 38
Accepted
time: 5ms
memory: 3884kb

input:

1 0 0 0 1 0 1 1 1 -1
0 1 0 0 0 1 0 1 1 0 1 1 1 1 1 1 1 1 1 1 -1
1 0 1 0 0 1 1 1 1 0 1 0 1 1 0 0 0 0 1 0 1 1 1 1 1 1 1 1 1 -1
1 0 1 1 1 0 1 0 0 0 1 1 0 0 1 0 1 1 1 0 1 1 1 1 1 1 1 1 1 -1
1 0 0 1 0 0 1 0 1 0 1 1 0 1 1 1 0 0 0 1 1 1 1 1 1 1 1 1 1 -1
1 0 1 0 0 0 1 1 1 0 0 0 1 1 1 1 0 0 1 0 1 1 1 1 1 1 1...

output:

-1
1 1 1 1 1 1 1 1 1 -1
1 0 1 0 1 0 1 0 1 0 0 0 1 1 0 0 0 1 0 0 1 1 1 1 1 1 1 1 1 -1
1 0 0 1 0 1 0 1 0 0 0 0 0 1 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 -1
1 0 1 0 0 1 1 1 1 0 1 0 1 0 0 1 0 0 1 1 1 1 1 1 1 1 1 1 1 -1
1 0 1 0 0 1 0 0 0 0 1 0 1 1 0 0 1 1 0 1 1 1 1 1 1 1 1 1 1 -1
0 1 1 1 1 0 1 1 1 0 1 0 1 1 1 1 ...

input:


output:

0
254195
204724
119091
97169
161776
43101
290118
178213
204344
171556
20729
128866
253399
159707
176488
177264
14928
309186
7722
267342
63030
176726
250689
128579
274660
35373
92578
184511
109010
58998
254635
200113
300743
113313
234507
56172
258975
256003
149419
231641
36184
136692
249223
230383
21...

result:

ok 900 lines

Test #30:

score: 38
Accepted
time: 7ms
memory: 3928kb

input:

1 1 1 1 1 1 1 1 1 -1
1 0 1 0 1 1 0 1 1 -1
0 0 0 1 1 1 0 0 0 0 0 0 0 0 0 1 0 1 1 0 1 1 1 1 1 1 1 1 1 -1
1 1 0 1 1 1 0 0 0 -1
0 1 1 0 0 1 1 0 0 -1
0 1 0 1 1 1 0 0 1 -1
0 1 0 0 1 0 1 1 1 -1
0 1 1 1 1 0 1 1 1 -1
0 1 1 1 1 0 0 1 0 -1
0 0 1 1 0 1 0 1 1 0 0 0 0 0 1 1 1 1 1 0 1 0 1 1 0 1 0 0 0 -1
0 0 1 1 1 ...

output:

-1
0 1 0 0 0 1 1 0 1 0 1 0 0 0 1 1 0 1 1 1 1 0 0 1 0 0 0 1 1 -1
0 1 0 1 0 1 0 1 1 0 0 0 1 1 0 0 1 1 1 1 -1
0 0 0 1 0 0 0 0 1 0 0 1 0 1 0 0 1 0 1 0 0 0 0 1 1 0 0 0 1 -1
0 0 0 1 0 1 1 1 0 1 1 0 0 0 0 1 0 0 1 1 -1
0 1 0 0 0 1 1 0 0 0 1 0 0 0 1 0 0 0 1 0 -1
0 0 0 0 1 0 0 1 0 0 0 0 0 1 0 1 1 0 0 1 -1
0 1...

input:


output:

0
25277
26805
15193
35909
44825
48971
4157
19379
18934
58040
56499
18305
37267
41159
15689
56551
33746
8192
7081
41964
31606
488
5159
11039
1231
11924
42328
45323
16351
26035
47328
5772
3436
43382
24053
33033
58005
8503
32728
51229
46034
52127
45183
22839
6672
11670
44298
24112
49712
1380
17322
5471...

result:

ok 899 lines

Test #31:

score: 38
Accepted
time: 6ms
memory: 3900kb

input:

0 1 1 0 1 0 1 1 1 -1
0 1 0 0 0 0 1 0 1 0 1 1 0 1 0 0 1 1 1 1 0 0 0 1 1 1 1 1 1 -1
0 1 0 0 0 1 0 0 0 -1
0 1 0 0 0 0 0 0 0 -1
0 0 1 1 0 0 1 1 1 0 1 0 0 1 1 1 1 0 0 1 0 0 1 0 0 0 1 0 0 -1
0 0 0 1 1 0 0 1 1 1 0 0 0 1 1 0 0 1 1 1 -1
1 0 0 0 0 1 1 0 0 -1
0 1 0 1 0 1 1 1 0 0 0 1 0 1 0 1 1 1 0 1 0 0 1 0 1 1...

output:

-1
0 0 0 0 1 0 0 1 1 0 0 1 0 1 1 1 0 0 1 1 0 1 1 0 1 1 1 0 1 -1
0 0 0 1 1 1 0 0 1 0 0 1 0 1 1 0 1 1 0 0 0 0 0 0 0 1 0 0 0 -1
0 1 0 0 1 1 0 1 1 1 0 0 0 0 0 1 1 0 0 1 -1
0 1 1 0 1 0 0 0 0 1 0 0 1 1 0 1 1 1 0 0 -1
0 0 1 1 1 0 1 0 1 -1
0 0 0 1 1 0 0 0 1 0 0 0 0 1 0 0 1 0 0 0 0 0 1 0 1 1 1 1 0 -1
0 0 1 1...

input:


output:

0
43507
25929
55747
2431
3576
37955
53713
13426
53622
13425
22518
60091
47411
52049
11708
5692
43483
18855
16072
45029
33518
23451
44394
7204
53193
21582
32062
30688
50100
31795
29498
40857
15537
21080
55173
24066
37834
39655
59219
30612
34288
31773
49561
52053
22220
36611
53251
43188
53180
21786
44...

result:

ok 900 lines

Test #32:

score: 38
Accepted
time: 96ms
memory: 8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 1 0 1 0 0 0 0 0 0 1 1 0 0 0 0 1...

output:

-1
0 1 0 1 1 0 1 0 1 -1
0 0 1 0 1 1 0 1 0 -1
0 0 1 0 0 0 1 0 1 0 1 1 0 0 0 0 1 0 0 0 0 0 0 0 0 0 1 0 0 -1
0 0 1 1 0 0 1 0 1 0 0 0 0 0 0 1 0 1 1 0 -1
0 0 0 0 0 1 1 1 1 -1
0 0 0 0 0 0 0 1 0 0 1 0 0 1 1 0 0 1 1 1 0 0 0 0 0 0 0 0 1 -1
0 1 0 1 0 0 0 0 0 0 0 0 0 0 0 0 1 0 1 0 -1
0 0 0 0 0 0 0 0 1 0 0 1 0 ...

input:


output:

0
810
468
495
482
639
338
659
619
581
322
384
968
360
740
678
670
427
511
460
548
362
664
510
535
813
716
417
687
341
535
598
396
456
606
702
613
531
524
696
785
417
504
667
534
593
597
502
475
388
387
339
627
786
601
520
505
655
521
665
566
825
644
628
384
513
638
593
430
565
574
461
784
507
688
69...

result:

ok 899 lines

Test #37:

score: 38
Accepted
time: 1ms
memory: 3820kb

input:

1 1 1 1 1 1 1 1 1 -1
-1
-1

output:

-1
1 1 1 1 1 1 1 1 1 -1
-1

input:


output:

0

result:

ok single line: '0'

Subtask #5:

score: 14
Accepted

Test #38:

score: 14
Accepted
time: 0ms
memory: 3900kb

input:

0 0 1 0 1 1 1 1 0 -1
0 1 1 1 0 1 1 1 1 0 0 1 1 1 1 1 1 1 1 1 -1
1 0 0 1 0 1 1 0 1 -1
1 0 0 1 0 1 1 0 1 -1
0 1 1 1 1 1 0 0 1 0 0 0 1 0 0 1 0 1 0 1 1 0 0 1 0 0 1 0 0 -1
0 1 1 0 0 1 1 0 1 0 0 0 0 1 0 0 0 1 1 1 -1
0 1 0 1 1 1 1 0 1 1 0 0 1 0 0 0 0 0 1 1 -1
0 0 1 0 0 1 1 0 0 0 0 1 1 0 0 0 0 1 0 1 1 0 0 1...

output:

-1
1 1 1 1 1 1 1 1 1 -1
1 0 1 1 0 1 1 0 1 0 1 1 0 1 1 1 0 0 0 1 0 0 0 0 0 0 0 0 0 -1
0 1 1 0 1 1 0 0 0 0 1 0 0 0 1 1 0 1 0 0 -1
0 1 1 1 1 1 0 0 0 0 1 1 1 1 1 1 1 1 1 1 -1
1 1 0 1 0 0 0 1 0 -1
0 0 1 1 1 1 1 1 0 -1
0 0 0 1 1 0 1 1 1 0 1 0 0 1 0 1 0 1 1 0 1 0 1 0 0 0 0 0 1 -1
0 1 1 1 1 0 1 0 1 0 0 0 0 ...

input:


output:

0
3467
3039
3862
3565
4266
3258
4604
3860
2661
3573
3113
2706
3757
4805
4448
4392
3163
3673
4568
3500
3334
3197
2491
4036
2868
3743
4219
2747
3122
3210
2314
3397
3285
2805
2031
2187
3950
3654
3459
3114
3197
1499
5106
3000
3488
3210
3597
4420
3511
4094
3802
3848
2962
4031
3068
4292
3084
4077
4153
407...

result:

ok 1100 lines

Test #39:

score: 14
Accepted
time: 0ms
memory: 4112kb

input:

0 0 0 0 0 0 0 1 1 -1
0 0 1 0 1 0 0 0 0 1 1 0 0 0 0 0 0 1 0 1 -1
0 1 0 1 1 1 0 1 1 0 1 0 0 0 0 0 0 1 1 0 -1
0 0 1 1 1 1 0 1 1 1 1 0 0 0 0 0 0 1 0 0 -1
0 1 1 1 0 0 0 1 1 1 0 0 0 0 0 0 0 0 1 1 -1
0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 1 1 0 -1
0 0 1 1 0 0 1 0 1 1 0 0 0 0 0 0 0 0 0 1 -1
0 1 0 1 1 0 1 1 0 0 1...

output:

-1
0 1 0 1 0 1 0 1 0 -1
0 1 0 1 0 0 1 1 1 -1
0 1 0 1 0 0 0 1 0 -1
0 1 0 0 1 1 1 0 0 -1
0 1 0 0 1 1 0 0 0 -1
0 1 0 0 1 0 1 0 1 -1
0 1 0 0 0 1 1 1 1 -1
0 1 0 0 0 1 1 1 0 -1
0 1 0 0 0 1 0 0 0 -1
0 1 0 0 0 0 0 1 1 -1
0 1 0 0 0 0 0 1 0 -1
0 0 1 1 1 1 1 1 0 -1
0 0 1 1 1 1 0 1 1 -1
0 0 1 1 1 1 0 0 1 -1
0 0...

input:


output:

0
485
399
2142
681
2834
3651
3030
983
464
2014
2770
2896
691
1552
1351
213
2098
1101
1045
3762
3341
778
644
3199
1965
2409
3611
1656
812
3557
329
613
1997
1194
2828
3289
1513
2336
3551
2512
317
1189
3282
880
3169
1565
3554
637
764
294
1573
3516
3593
756
1533
2643
1941
1944
3766
84
538
2659
3720
21
2...

result:

ok 1100 lines

Test #40:

score: 14
Accepted
time: 4ms
memory: 3876kb

input:

1 1 1 1 0 0 0 1 1 -1
0 0 1 0 0 0 1 1 1 0 0 1 1 1 1 0 0 0 0 0 -1
0 0 0 1 0 1 1 0 0 1 0 1 1 1 1 0 0 1 1 0 -1
0 1 0 1 0 1 1 0 0 1 1 1 1 1 1 0 1 0 0 0 -1
0 0 1 0 0 1 1 1 0 0 0 1 1 1 1 0 1 1 1 0 -1
0 1 0 0 0 0 1 1 0 1 0 1 1 1 1 1 0 0 1 0 -1
1 0 0 0 0 1 0 0 1 0 1 1 1 1 1 0 1 0 1 1 -1
0 0 1 1 0 0 1 0 1 1 0...

output:

-1
1 1 1 1 1 1 1 1 1 -1
1 1 1 1 1 1 1 1 1 -1
1 1 1 1 1 1 1 1 1 -1
1 1 1 1 1 1 1 1 1 -1
1 1 1 1 1 1 1 1 1 -1
1 1 1 1 1 1 1 1 1 -1
1 1 1 1 1 1 1 1 1 -1
1 1 1 1 1 1 1 1 1 -1
1 1 1 1 1 1 1 1 1 -1
1 1 1 1 1 1 1 1 1 -1
1 1 1 1 1 1 1 1 1 -1
1 1 1 1 1 1 1 1 1 -1
1 1 1 1 1 1 1 1 1 -1
1 1 1 1 1 1 1 1 1 -1
1 1...

input:


output:

0
210526
379348
30270
237071
524240
475727
459547
248812
335379
257106
398469
131103
219828
81790
511965
128693
170425
404799
477680
155716
337816
356356
346125
446801
82284
206625
383283
150289
57817
395524
346617
490398
326552
203201
92509
471818
114979
318729
122347
109099
175823
253216
192446
45...

result:

ok 1100 lines

Test #41:

score: 14
Accepted
time: 51ms
memory: 9240kb

input:

0 0 1 1 1 1 1 1 0 -1
0 0 0 1 1 0 0 1 0 -1
0 0 0 1 0 1 0 1 0 -1
0 0 0 1 0 0 1 0 1 -1
0 0 0 1 0 0 0 0 1 -1
0 0 0 0 1 1 1 0 1 -1
0 0 0 0 1 0 1 1 0 -1
0 0 0 0 0 1 1 1 1 -1
0 0 0 0 0 1 0 1 0 -1
0 0 0 0 0 0 1 0 1 -1
0 0 0 0 1 1 1 1 1 -1
0 0 0 0 1 1 0 1 1 -1
0 0 0 0 1 0 1 1 1 -1
0 0 0 0 0 1 1 1 1 -1
0 0 0 ...

output:

-1
0 0 0 0 0 1 0 1 0 0 0 1 0 0 1 1 0 0 0 1 0 0 0 0 0 1 0 0 0 -1
0 1 1 1 1 0 1 0 0 0 0 0 0 0 0 0 0 1 0 1 -1
0 0 0 0 0 0 0 1 1 1 1 0 0 0 0 0 0 1 0 0 -1
0 1 0 1 1 0 0 1 0 1 0 0 0 0 0 0 0 1 0 0 -1
0 1 1 1 1 0 0 1 0 1 0 0 0 0 0 0 0 1 1 1 -1
0 0 0 0 0 0 1 1 0 1 1 0 0 0 0 0 0 1 1 1 -1
0 0 1 0 0 1 0 0 0 1 1...

input:


output:

0
2364
2591
4037
1605
414
3363
1276
5694
1847
3578
4251
5658
2844
3170
23
3702
764
1242
4358
1494
5117
3596
4418
5206
2620
3349
38
4961
502
4135
4230
2021
1158
2696
2980
5841
859
1554
5229
712
2959
4312
977
3236
985
5852
1880
349
4246
3956
2035
1665
4912
4142
2204
3493
3941
4442
4979
4782
3881
2721
...

result:

ok 1100 lines

Test #42:

score: 14
Accepted
time: 0ms
memory: 3876kb

input:

1 1 1 1 0 0 0 0 1 -1
1 1 1 1 0 1 1 1 1 0 1 1 1 0 1 0 1 0 0 1 1 1 1 1 1 0 0 0 1 -1
1 1 1 1 0 0 1 0 0 0 1 0 1 1 0 1 1 0 1 1 1 1 1 1 1 0 0 1 0 -1
1 1 1 1 0 0 1 0 0 0 0 1 0 1 0 1 1 1 0 1 1 1 1 1 1 0 0 1 1 -1
1 1 1 1 0 0 0 0 1 0 0 0 1 0 0 0 0 1 0 1 1 1 1 1 1 0 0 0 1 -1
1 1 1 1 0 1 1 0 1 0 1 1 0 0 1 0 0 1...

output:

-1
1 1 1 1 0 0 0 0 0 1 0 0 0 0 0 1 0 1 1 1 1 1 1 1 1 0 0 0 0 -1
1 1 1 1 0 1 1 0 1 0 1 0 0 1 0 1 0 0 1 0 1 1 1 1 1 0 0 0 1 -1
1 1 1 1 0 1 1 1 1 0 0 1 0 1 1 1 0 0 1 1 1 1 1 1 0 1 1 1 1 -1
1 1 1 1 1 0 0 0 0 0 0 1 1 0 0 1 0 1 0 0 1 1 1 1 1 0 0 1 1 -1
1 1 1 1 0 0 0 0 0 1 0 0 0 0 1 0 1 1 0 1 1 1 1 1 1 0 1...

input:


output:

0
340247
281511
481199
261964
236970
75001
397977
168553
536533
231571
280526
143501
465039
472377
246251
164125
86247
100966
490973
58851
498320
214467
395518
138127
372035
252612
255060
509604
119520
377892
116589
42134
337782
524257
511573
244797
258498
23019
212502
202750
507150
454297
136661
15...

result:

ok 1100 lines

Test #43:

score: 14
Accepted
time: 49ms
memory: 9244kb

input:

0 0 0 0 0 0 1 0 1 -1
0 1 1 0 1 1 0 1 1 1 0 0 0 1 0 0 1 0 1 0 -1
0 0 0 0 0 0 1 1 0 0 0 1 1 1 1 0 1 1 1 1 0 0 0 1 0 0 0 1 0 -1
0 0 0 0 0 0 1 1 1 0 0 1 0 1 0 1 1 0 1 0 0 0 0 0 1 1 0 1 0 -1
0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 1 1 1 1 1 0 0 0 1 0 0 1 0 0 -1
0 0 0 0 0 1 0 0 1 0 1 0 0 1 1 0 0 0 0 0 0 0 0 0 1 1 0...

output:

-1
0 0 0 0 1 1 0 1 1 -1
0 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 1 0 1 0 0 0 0 0 1 0 0 1 0 -1
0 0 0 0 0 0 0 0 1 0 0 0 0 1 0 0 1 0 0 1 0 0 0 1 0 1 1 1 0 -1
0 0 0 0 0 0 0 0 1 0 1 1 1 0 0 1 1 0 0 1 0 0 0 0 1 1 0 0 1 -1
0 0 0 0 0 0 0 0 1 0 0 1 1 1 0 0 0 1 0 0 0 0 0 0 0 1 0 1 0 -1
0 0 0 0 0 0 1 1 0 0 0 0 1 1 1 1 ...

input:


output:

0
2382
5419
4264
3453
2212
940
387
4911
331
4677
1520
2246
1426
857
5397
2323
1222
5442
958
324
4433
4019
2130
1505
962
3350
4920
2673
798
616
26
717
90
3526
884
4514
2573
1813
3136
4801
3004
3795
1591
4001
3992
3929
4084
2508
1760
450
2138
4441
744
2364
1115
4684
5241
4059
2548
3726
5293
1534
1780
...

result:

ok 1100 lines

Test #44:

score: 14
Accepted
time: 1ms
memory: 3948kb

input:

1 1 1 1 1 1 1 1 1 -1
0 0 1 1 0 0 0 1 1 0 0 1 0 0 0 1 0 0 0 1 0 0 0 0 1 1 0 0 0 -1
0 1 0 1 0 1 1 0 1 0 0 0 0 0 0 1 1 0 1 0 -1
0 0 1 1 1 1 1 0 1 0 1 0 0 1 1 1 1 1 1 1 -1
0 0 1 1 0 0 0 1 1 -1
0 0 1 0 0 0 0 1 0 1 0 0 0 0 0 1 1 0 0 0 0 0 0 0 0 1 1 0 1 -1
0 1 0 0 0 0 0 0 0 1 0 0 0 0 1 1 1 0 1 0 -1
0 1 1 1...

output:

-1
0 0 1 0 0 0 0 0 0 0 1 0 1 1 1 0 0 1 1 1 1 0 0 1 1 0 1 1 1 -1
0 0 0 1 0 1 1 1 0 -1
0 0 1 0 1 0 1 1 0 -1
0 0 0 1 1 1 1 0 0 1 0 0 0 0 0 0 1 1 0 1 0 0 0 1 0 0 0 0 1 -1
0 0 0 1 1 0 1 1 1 1 0 1 1 1 1 1 1 1 1 1 -1
0 1 0 1 1 0 1 1 1 -1
0 1 0 1 0 1 0 1 0 -1
0 0 1 1 1 0 0 0 0 -1
0 0 1 1 1 0 0 0 0 0 0 1 0 0...

input:


output:

0
56612
46646
70332
29956
46342
11842
17257
59957
40858
70493
22180
23014
49433
71497
6230
58197
55258
37226
38791
40531
57212
28743
46826
64193
43311
53343
28705
57981
53729
36109
14630
16707
68352
749
64100
39470
20223
58014
34874
28467
42764
6806
39240
21423
16155
51419
13259
47410
43258
8051
602...

result:

ok 1099 lines

Test #45:

score: 14
Accepted
time: 0ms
memory: 4228kb

input:

0 0 0 0 0 1 1 1 1 -1
0 1 0 1 1 0 0 1 0 1 0 0 0 1 1 1 0 0 1 0 -1
0 0 1 0 1 0 0 0 1 1 0 0 0 1 1 0 1 0 1 1 -1
0 0 0 0 0 1 0 1 1 0 1 1 0 1 1 0 0 1 0 1 1 0 0 0 0 0 0 1 1 -1
0 0 0 1 1 0 0 0 0 -1
0 1 0 1 0 1 1 0 0 0 0 0 1 1 0 1 0 0 1 0 1 1 1 1 1 1 1 1 1 -1
0 1 0 1 1 1 0 0 0 -1
0 0 1 0 1 1 1 1 1 -1
0 1 0 0 ...

output:

-1
0 1 1 1 0 0 0 0 1 -1
0 1 1 0 1 0 0 1 0 -1
0 0 1 1 0 0 0 0 0 0 1 0 1 1 1 0 0 1 0 0 0 1 1 1 1 1 1 0 0 -1
0 1 1 0 1 0 0 1 1 0 1 1 1 1 1 0 1 1 0 1 0 0 0 0 1 1 0 1 1 -1
0 1 0 0 0 1 1 1 1 1 1 0 1 0 1 1 1 1 1 1 -1
0 0 0 0 1 1 1 1 1 0 1 0 1 0 1 0 0 1 1 1 0 0 0 0 0 0 0 1 1 -1
0 0 0 0 0 1 1 1 0 0 1 0 0 0 0...

input:


output:

0
13779
31463
50623
3014
16772
66071
45164
46748
851
25183
32310
36312
24768
39627
24518
72796
65480
57846
33639
33178
5571
29978
52735
57311
58959
19352
8162
21002
71234
77215
71183
11254
49123
68218
21300
10788
7964
75919
72172
32240
23160
64342
57922
15603
7913
50574
72859
50973
13531
13119
69870...

result:

ok 1100 lines

Test #46:

score: 14
Accepted
time: 133ms
memory: 9264kb

input:

0 0 0 0 0 0 0 0 1 -1
0 0 0 1 1 0 0 0 0 1 1 0 0 0 0 0 0 0 0 1 -1
1 0 0 0 0 1 0 1 0 1 1 0 0 0 0 0 0 0 0 0 -1
0 1 0 1 1 0 1 1 0 1 1 0 0 0 0 0 0 0 0 0 -1
0 1 0 1 1 0 1 1 0 0 0 0 0 0 0 0 0 0 0 0 -1
0 1 0 0 1 1 1 0 1 0 1 0 0 0 0 0 0 0 0 0 -1
0 0 0 1 1 1 0 0 0 1 1 0 0 0 0 0 0 0 0 1 -1
0 1 1 1 1 1 1 0 0 1 0...

output:

-1
1 1 1 1 1 1 1 1 1 -1
1 1 1 1 1 1 1 1 1 -1
1 1 1 1 1 1 1 1 1 -1
1 1 1 1 1 1 1 1 1 -1
1 1 1 1 1 1 1 1 1 -1
1 1 1 1 1 1 1 1 1 -1
1 1 1 1 1 1 1 1 1 -1
1 1 1 1 1 1 1 1 1 -1
1 1 1 1 1 1 1 1 1 -1
1 1 1 1 1 1 1 1 1 -1
1 1 1 1 1 1 1 1 1 -1
1 1 1 1 1 1 1 1 1 -1
1 1 1 1 1 1 1 1 1 -1
1 1 1 1 1 1 1 1 1 -1
1 1...

input:


output:

0
9
6
10
7
9
9
6
7
8
7
8
8
8
9
4
3
9
5
7
7
9
4
7
8
7
9
10
7
6
8
7
14
5
5
9
8
5
6
7
9
8
8
7
7
7
6
8
5
7
8
7
6
6
8
8
8
8
8
7
6
7
6
7
7
5
8
7
7
8
7
9
5
3
6
7
5
6
7
6
8
8
9
6
7
6
7
9
4
9
8
8
5
9
8
7
5
6
7
7
8
9
6
7
10
7
5
8
6
8
9
6
5
8
9
6
7
7
5
7
7
7
7
7
7
7
7
6
8
8
8
6
7
8
5
6
7
6
7
8
8
9
8
8
7
8
9
9
...

result:

ok 1100 lines

Test #47:

score: 14
Accepted
time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1 1 0 1 0 0 0 0 0 0 0 1 0 1 1 0 -1
0 0 0 0 0 1 0 1 1 -1
0 0 0 0 0 0 1 1 0 0 0 0 0 1 1 0 0 1 0 0 0 0 0 0 0 0 1 1 0 -1
0 1 0 0 0 0...

output:

-1
0 0 0 0 0 0 1 1 1 0 0 1 1 1 1 0 0 1 0 1 0 0 0 0 1 0 1 1 0 -1
0 0 0 1 0 1 0 1 0 1 1 0 0 0 0 1 1 0 0 0 -1
0 0 0 0 1 0 0 0 0 0 1 1 0 0 0 0 0 1 1 0 0 0 0 1 0 0 1 0 1 -1
0 0 0 0 1 0 0 0 1 -1
0 0 0 0 0 1 0 1 1 0 0 0 0 1 1 1 1 1 1 0 0 0 0 0 0 0 1 0 1 -1
0 1 0 0 1 1 0 0 1 1 0 0 0 0 0 1 1 1 0 0 -1
0 0 0 0...

input:


output:

0
557
342
401
405
567
510
647
494
715
369
504
915
441
524
270
490
581
333
406
480
350
404
499
726
362
695
943
362
534
536
292
394
421
888
428
483
370
526
461
432
422
542
360
580
481
559
474
221
524
296
524
176
352
743
461
381
556
407
260
280
392
361
540
275
345
455
571
520
559
619
422
329
481
520
54...

result:

ok 1098 lines

Subtask #6:

score: 10
Accepted

Test #51:

score: 10
Accepted
time: 3ms
memory: 3972kb

input:

1 1 1 1 1 1 1 1 1 -1
1 1 1 1 1 1 1 1 1 -1
0 0 0 1 0 1 1 0 0 -1
0 0 0 0 0 0 0 0 1 0 1 0 0 0 1 1 0 0 1 0 0 0 0 1 0 1 0 1 0 -1
0 1 1 0 0 1 1 0 1 0 1 1 0 0 1 1 0 0 0 1 -1
0 1 0 0 1 0 1 0 0 1 0 0 0 0 0 1 0 1 0 0 -1
0 1 1 0 1 1 0 0 0 0 1 0 0 0 1 0 0 1 1 1 -1
0 0 0 0 1 1 1 1 0 0 1 1 0 1 1 0 0 0 0 0 0 0 0 0...

output:

-1
0 1 0 1 1 0 0 0 0 0 1 0 1 0 1 1 1 1 0 1 1 0 1 0 0 1 0 1 0 -1
0 1 1 1 0 1 0 1 1 1 0 0 0 0 0 0 0 0 0 1 -1
0 1 1 0 1 1 0 0 1 1 1 1 1 1 1 1 1 1 1 1 -1
1 1 1 1 1 1 1 1 1 -1
1 0 1 0 0 1 1 1 0 -1
0 0 0 0 1 1 1 0 1 -1
0 0 0 0 0 1 0 0 1 0 0 0 1 1 0 0 0 0 0 1 0 0 1 1 1 1 0 1 1 -1
0 0 1 0 1 1 1 0 1 -1
0 0 1...

input:


output:

0
4745
3326
5133
4107
3809
4087
3569
3801
3371
5482
4438
4540
1609
3082
3493
5097
2942
4117
3617
3593
4172
4473
4646
2942
4752
2852
3739
4756
2996
4071
3100
3564
2168
4235
4849
4666
4920
5046
3687
4237
1693
3180
3644
4302
3744
3547
3893
5204
4387
3021
4202
4162
4068
4622
4081
4042
5002
3673
3223
271...

result:

ok 1400 lines

Test #52:

score: 10
Accepted
time: 1ms
memory: 3948kb

input:

0 1 0 0 1 0 0 1 1 -1
0 1 0 0 0 1 0 1 1 -1
0 1 0 0 0 0 1 1 1 -1
0 0 1 1 1 1 1 1 0 -1
0 0 1 1 1 1 0 0 1 -1
0 0 1 1 1 0 1 0 1 -1
0 0 1 1 0 1 1 0 1 -1
0 0 1 1 0 0 1 1 1 -1
0 0 1 0 1 1 1 0 1 -1
0 0 1 0 1 1 0 1 0 -1
0 0 1 0 1 0 1 1 1 -1
0 0 1 0 0 1 1 1 1 -1
0 0 1 0 0 1 1 0 0 -1
0 0 1 0 0 1 0 0 0 -1
0 0 1 ...

output:

-1
0 0 0 0 0 1 0 0 0 0 1 0 0 1 1 0 1 1 1 1 0 0 0 0 0 0 1 0 0 -1
1 0 0 0 0 0 1 1 0 1 1 0 0 0 0 0 1 0 0 1 -1
1 0 0 0 0 1 0 0 0 1 0 0 0 0 0 0 0 1 0 1 -1
0 0 0 0 0 1 0 0 0 0 1 0 0 0 0 0 0 1 0 0 -1
0 1 1 1 1 1 1 0 1 1 0 0 0 0 0 0 1 0 0 0 -1
0 1 1 1 0 1 1 0 1 0 1 0 0 0 0 0 0 1 1 0 -1
1 0 0 0 1 0 0 0 0 0 0...

input:


output:

0
1322
3847
7297
1111
1848
4534
963
6857
1143
5230
4985
6529
1758
4904
4743
1671
5896
622
466
2920
5036
2538
3118
2408
4402
4506
4191
736
942
2404
5008
3551
26
4793
4484
3567
2420
6757
3489
1112
130
4844
1859
81
570
5510
4544
2171
111
2224
1178
6304
4483
1088
886
3247
860
4292
4103
1817
1904
777
335...

result:

ok 1400 lines

Test #53:

score: 10
Accepted
time: 141ms
memory: 17884kb

input:

0 0 0 0 0 0 0 1 0 -1
0 0 1 1 1 1 0 1 1 0 1 0 0 0 0 0 0 0 1 0 -1
0 1 0 1 1 0 1 1 0 0 0 0 0 0 0 0 0 0 0 1 -1
0 0 0 1 1 1 0 1 1 1 1 0 0 0 0 0 0 0 0 1 -1
0 0 1 0 1 1 1 0 1 0 0 0 0 0 0 0 0 0 1 0 -1
1 0 0 1 1 0 0 1 1 1 1 0 0 0 0 0 0 0 1 0 -1
0 1 1 0 0 1 0 1 0 0 1 0 0 0 0 0 0 0 0 1 -1
1 0 1 0 1 1 0 1 0 0 0...

output:

-1
0 0 1 0 0 0 0 0 1 -1
0 0 0 0 1 1 1 1 0 -1
0 0 0 0 1 1 1 0 0 -1
0 0 0 0 1 1 0 1 1 -1
0 0 0 0 1 0 0 1 0 -1
0 0 0 0 1 0 0 0 0 -1
0 0 0 0 0 1 1 0 1 -1
0 0 0 0 0 1 1 0 1 -1
0 0 0 0 0 1 0 1 1 -1
0 0 0 0 0 1 0 1 0 -1
0 0 0 0 0 1 0 0 1 -1
0 0 0 0 0 1 0 0 0 -1
0 0 0 0 0 0 1 1 1 -1
0 0 0 0 0 0 1 1 0 -1
0 0...

input:


output:

0
1946
1393
1639
22
1939
1656
99
1387
1834
778
1732
1696
340
1504
321
108
851
1055
613
477
640
175
1468
677
1652
1780
217
740
1675
1707
1399
456
1753
2007
1731
1431
1973
786
431
1781
1786
671
1679
1878
1140
293
202
1173
1663
122
1445
684
1408
1419
544
1906
574
1354
1816
763
1430
2022
313
2063
1312
4...

result:

ok 1400 lines

Test #54:

score: 10
Accepted
time: 0ms
memory: 4180kb

input:

1 1 1 1 1 1 1 1 1 -1
1 1 1 1 1 1 1 1 1 -1
1 1 1 1 1 1 1 1 1 -1
1 1 1 1 1 1 1 1 1 -1
1 1 1 1 1 1 1 1 1 -1
1 1 1 1 1 1 1 1 1 -1
1 1 1 1 1 1 1 1 1 -1
1 1 1 1 1 1 1 1 1 -1
1 1 1 1 1 1 1 1 1 -1
1 1 1 1 1 1 1 1 1 -1
1 1 1 1 1 1 1 1 1 -1
1 1 1 1 1 1 1 1 1 -1
1 1 1 1 1 1 1 1 1 -1
1 1 1 1 1 1 1 1 1 -1
1 1 1 ...

output:

-1
1 1 0 0 0 1 1 0 0 1 0 0 0 0 1 0 0 1 0 1 1 0 1 1 0 0 1 0 1 -1
1 0 1 0 1 0 1 1 1 1 0 1 0 1 0 1 1 1 0 0 -1
1 0 0 1 1 1 1 0 0 0 0 1 1 1 1 0 1 1 1 0 -1
1 0 1 0 1 0 0 0 0 0 1 1 1 0 0 0 1 0 0 0 -1
1 0 0 0 1 1 0 1 1 0 1 1 0 1 0 0 1 0 1 0 -1
1 0 0 1 1 1 0 0 1 0 0 1 1 0 0 1 1 1 1 0 -1
1 0 1 0 1 0 0 0 1 1 0...

input:


output:

0
123618
325605
373557
3095
215569
359767
181294
146617
121060
302418
513838
473825
269086
69788
284057
6553
75606
404330
516765
453617
52651
158846
499026
68510
206419
336405
242434
499675
427701
186572
243227
224127
366651
33353
218056
48482
282573
262550
67590
343717
215253
298648
231392
32103
26...

result:

ok 1400 lines

Test #55:

score: 10
Accepted
time: 105ms
memory: 15512kb

input:

0 0 0 1 1 0 1 1 1 -1
0 0 0 0 0 0 1 1 0 0 0 1 0 1 0 1 1 0 0 1 0 0 0 1 0 1 0 1 1 -1
0 0 0 0 0 0 0 1 1 0 1 1 0 1 1 0 1 1 1 0 0 0 0 0 1 1 1 0 0 -1
0 0 0 0 0 0 0 0 1 0 1 0 1 0 0 1 1 0 0 0 0 0 0 0 0 1 1 0 1 -1
0 0 0 0 0 0 0 1 1 0 1 1 1 1 0 1 1 0 1 1 0 0 0 0 1 0 0 1 1 -1
0 0 0 0 0 0 1 0 1 0 0 0 1 0 1 1 0 0...

output:

-1
0 0 0 0 0 0 1 1 0 0 0 1 1 1 0 1 1 0 0 1 0 0 0 0 1 1 1 0 0 -1
0 0 0 0 0 0 1 0 1 0 0 0 0 0 1 0 1 0 0 1 0 0 0 0 1 0 0 0 1 -1
0 0 0 0 0 0 0 1 1 0 0 0 1 1 1 1 1 0 1 1 0 0 0 0 0 1 0 1 1 -1
0 0 0 0 0 0 0 1 0 0 0 1 0 0 0 1 0 1 0 0 0 0 0 0 0 1 0 0 0 -1
0 0 0 0 0 0 0 0 1 1 0 0 0 1 1 1 1 0 0 1 0 0 0 0 1 0 1...

input:


output:

0
1650
3059
720
1596
2577
2736
3880
3078
1459
4855
2403
2072
2522
3641
3990
1567
839
4302
2993
4384
2983
4335
1099
2239
2979
4083
813
701
264
3186
3267
3899
910
954
3921
1304
1804
3441
1535
3465
17
1429
4489
1948
1576
286
1731
2954
1824
1819
3677
487
2531
2316
1782
2440
3792
1997
3004
3688
3764
3477...

result:

ok 1400 lines

Test #56:

score: 10
Accepted
time: 0ms
memory: 3996kb

input:

1 1 1 0 0 0 1 1 0 -1
0 0 0 1 0 0 1 1 1 0 0 1 1 0 0 0 0 1 1 1 -1
1 0 1 1 1 0 1 1 0 1 0 1 0 1 0 0 0 0 1 0 1 1 1 1 0 0 1 0 0 -1
1 1 0 1 0 0 1 0 0 0 0 1 0 1 0 1 1 1 0 0 1 1 1 1 0 1 1 0 1 -1
1 1 0 0 0 1 0 1 1 0 0 0 0 1 1 0 0 1 1 1 1 1 0 1 1 1 0 1 1 -1
1 1 0 0 0 0 1 0 0 0 1 1 0 1 0 1 1 1 0 1 1 1 1 0 1 1 0...

output:

-1
1 1 1 0 0 1 0 0 1 -1
1 0 0 1 0 1 0 0 1 1 0 0 0 1 1 1 1 1 0 0 1 1 0 1 1 0 1 0 0 -1
1 1 1 1 0 0 0 1 1 1 0 0 0 1 1 1 1 1 0 1 1 1 1 0 0 1 1 1 1 -1
1 1 1 0 1 1 0 0 1 1 0 0 0 1 1 1 1 0 1 0 1 1 0 1 1 0 0 1 0 -1
1 1 0 1 0 0 1 0 0 1 0 1 0 0 1 1 1 0 0 0 1 1 1 1 0 1 0 0 1 -1
1 1 0 0 0 0 1 1 1 1 0 1 0 0 1 1 ...

input:


output:

0
527233
497614
191530
503517
341895
85570
251120
423540
438801
498571
283991
22733
233912
195995
495218
175149
185812
246238
188904
386751
430686
353390
510731
243441
384993
251774
493322
394709
472549
398352
151431
182166
165086
414181
331962
506183
220800
321331
336546
93905
144738
233014
181431
...

result:

ok 1400 lines

Test #57:

score: 10
Accepted
time: 6ms
memory: 3980kb

input:

0 1 1 0 1 1 1 0 1 -1
0 1 0 1 0 0 1 1 0 0 0 0 1 0 1 0 1 0 0 1 -1
0 0 1 0 1 1 1 0 1 0 0 1 0 1 1 0 0 0 1 1 1 0 1 0 0 1 1 0 0 -1
0 1 1 1 1 0 1 0 0 -1
0 1 0 0 1 1 0 0 1 1 0 1 0 0 1 1 1 1 1 0 0 0 1 0 0 0 0 1 0 -1
0 0 0 1 0 1 0 1 0 0 0 0 1 1 0 1 0 1 0 1 1 1 1 0 1 1 0 0 0 -1
0 0 1 1 1 0 0 0 0 -1
0 1 0 0 1 0...

output:

-1
1 1 1 1 1 1 1 1 1 -1
0 0 1 0 0 0 0 0 0 0 1 1 1 1 1 0 0 0 0 1 0 1 1 0 0 1 1 1 0 -1
0 0 1 1 1 0 0 0 1 0 1 0 0 1 0 1 0 0 1 1 0 0 0 0 1 1 0 0 1 -1
0 0 1 0 0 1 1 0 1 0 0 0 1 0 1 1 1 0 1 1 -1
0 0 0 1 0 0 0 1 0 0 1 0 1 1 0 0 0 1 0 0 0 0 1 0 0 1 1 1 0 -1
0 0 0 1 0 0 1 0 0 0 0 1 0 0 0 0 0 1 1 1 0 0 1 0 0 ...

input:


output:

0
69249
19894
27525
64030
80319
41290
57930
48962
22688
92119
91456
60910
63616
39416
89589
47172
2327
5537
93836
79736
56072
55686
42092
35822
15690
62806
69573
8603
14564
45026
53881
40807
35755
53735
27987
8072
64357
47639
54920
31083
42085
66808
76691
60047
68297
87353
44637
81350
67494
80034
66...

result:

ok 1399 lines

Test #58:

score: 10
Accepted
time: 2ms
memory: 3916kb

input:

0 1 1 0 1 0 1 1 1 -1
0 0 0 1 0 1 1 1 0 1 0 0 0 0 1 0 0 1 0 1 -1
1 0 0 0 0 0 0 0 1 0 1 0 0 1 1 0 1 1 1 1 -1
0 0 0 0 0 1 1 1 0 1 0 0 1 1 0 1 0 0 0 1 0 0 0 0 1 0 1 1 0 -1
0 0 0 0 1 1 0 1 1 0 0 0 0 0 0 0 1 0 0 0 -1
0 1 0 1 0 0 1 1 0 1 0 0 0 1 0 0 0 1 0 1 -1
0 1 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 1 0 0 -1
0 0...

output:

-1
1 0 1 1 1 1 0 0 0 -1
0 1 0 0 0 0 1 1 0 -1
0 0 1 1 0 0 0 0 1 0 1 1 1 0 1 1 1 0 0 0 1 1 1 1 1 1 1 1 1 -1
1 1 1 1 1 1 1 1 1 -1
0 0 1 1 0 1 0 0 0 -1
0 0 1 0 1 1 1 0 0 -1
0 0 0 0 1 0 1 1 1 0 0 1 0 1 0 1 1 1 0 1 0 0 1 0 0 0 0 1 0 -1
0 1 0 0 1 1 0 1 0 0 1 0 1 0 1 0 1 0 0 1 -1
0 1 0 0 0 0 1 0 0 0 0 0 0 1...

input:


output:

0
65671
51954
46989
27975
8965
27506
40881
85961
65485
17036
87269
43194
74200
87320
62891
4522
82878
75702
70199
68611
6557
72291
63344
47119
34643
49412
67486
32317
52613
73069
31475
32366
41140
63802
49819
52326
16653
64978
78765
58085
18859
18100
19683
38035
71330
88431
2255
54092
61603
19358
89...

result:

ok 1400 lines

Test #59:

score: 10
Accepted
time: 135ms
memory: 9180kb

input:

0 0 0 0 0 0 0 1 0 -1
1 0 1 0 1 0 0 1 0 1 1 0 0 0 0 0 0 0 0 0 -1
0 0 0 0 1 0 1 1 1 1 1 0 0 0 0 0 0 0 0 1 -1
1 0 1 0 1 0 1 1 0 1 1 0 0 0 0 0 0 0 0 0 -1
0 1 0 1 0 0 0 1 1 1 0 0 0 0 0 0 0 0 0 0 -1
0 0 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 -1
0 0 0 1 1 1 1 0 0 0 1 0 0 0 0 0 0 0 0 0 -1
0 0 0 0 1 0 0 1 1 1 0...

output:

-1
1 1 1 1 1 1 1 1 1 -1
1 1 1 1 1 1 1 1 1 -1
1 1 1 1 1 1 1 1 1 -1
1 1 1 1 1 1 1 1 1 -1
1 1 1 1 1 1 1 1 1 -1
1 1 1 1 1 1 1 1 1 -1
1 1 1 1 1 1 1 1 1 -1
1 1 1 1 1 1 1 1 1 -1
1 1 1 1 1 1 1 1 1 -1
1 1 1 1 1 1 1 1 1 -1
1 1 1 1 1 1 1 1 1 -1
1 1 1 1 1 1 1 1 1 -1
1 1 1 1 1 1 1 1 1 -1
1 1 1 1 1 1 1 1 1 -1
1 1...

input:


output:

0
9
9
6
6
10
10
9
6
10
9
9
10
8
8
9
10
8
10
7
9
8
9
9
9
10
3
11
8
8
9
9
8
10
10
10
10
11
7
9
7
7
5
8
10
9
11
7
8
10
7
10
10
8
10
10
9
8
10
10
9
7
8
8
8
10
8
7
8
9
7
9
9
9
7
7
6
10
3
7
7
10
6
9
11
7
7
10
8
10
11
8
7
10
9
2
10
8
12
8
8
8
10
11
9
8
10
10
9
8
8
9
8
8
6
9
7
9
12
9
9
9
9
9
10
9
10
10
7
12...

result:

ok 1400 lines

Test #60:

score: 10
Accepted
time: 140ms
memory: 27680kb

input:

1 1 1 1 1 1 1 1 1 -1
1 1 1 1 1 1 1 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1 -1
0 1 0 1 0 1 1 0 0 0 1 0 0 0 0 1 0 0 1 0 -1
0 0 1 0 1 ...

output:

-1
1 1 1 0 0 1 0 1 0 0 1 0 1 1 1 1 1 0 1 1 0 0 1 1 0 1 1 0 1 -1
0 0 0 1 0 0 0 0 0 1 0 0 0 1 1 0 1 1 0 1 0 0 1 0 0 0 1 0 1 -1
0 0 0 0 0 1 0 0 0 -1
0 0 0 0 0 0 1 0 0 0 0 0 1 0 1 1 0 0 1 1 0 0 1 0 1 0 0 1 1 -1
0 0 0 1 1 0 0 1 1 -1
0 0 0 0 1 1 0 0 0 -1
0 0 0 0 0 0 1 1 0 -1
0 0 0 0 0 0 0 0 1 0 0 1 1 1 1 ...

input:


output:

0
938
1076
1300
1046
1024
1161
962
890
1357
1166
908
1077
1049
1192
1103
1194
998
1234
977
1135
1164
1158
1064
763
1090
976
1366
1023
1121
768
1257
1201
1065
902
885
1003
1038
778
1086
1007
1160
972
1179
1129
816
1132
968
1249
1189
1110
718
1141
925
1126
1055
1184
1322
926
1070
1150
941
1207
1141
11...

result:

ok 1399 lines

Subtask #7:

score: 16
Accepted

Test #64:

score: 16
Accepted
time: 9ms
memory: 4064kb

input:

1 1 1 1 1 0 0 0 0 -1
1 0 0 0 1 1 1 0 1 0 0 1 0 0 0 1 1 1 1 0 -1
1 0 0 0 0 1 1 0 0 1 1 1 1 1 0 1 0 1 1 1 -1
0 1 0 0 1 0 1 1 0 1 1 0 0 1 1 0 0 1 1 0 -1
1 0 0 0 1 0 1 0 1 0 1 0 1 1 1 1 1 0 1 0 -1
0 1 1 1 1 1 0 0 0 1 0 0 0 1 1 1 1 1 0 1 -1
0 0 0 0 0 1 0 1 0 1 0 1 1 1 0 1 0 1 1 1 -1
1 1 1 0 1 1 1 0 0 1 0...

output:

-1
1 1 1 1 1 0 0 1 1 -1
1 1 1 1 1 0 0 1 1 -1
1 1 1 1 1 0 0 1 1 -1
1 0 0 0 1 0 1 0 0 -1
1 0 0 0 1 0 0 1 1 -1
0 0 1 1 1 1 1 1 1 -1
1 1 1 1 0 1 0 0 1 -1
0 1 1 1 1 1 0 1 1 -1
1 1 0 0 0 0 0 0 0 -1
1 1 1 1 0 0 1 1 0 -1
0 1 0 0 0 0 0 0 1 -1
1 1 0 1 0 1 1 1 0 -1
1 1 1 0 1 0 1 0 0 -1
1 1 0 0 0 1 1 0 1 -1
1 1...

input:


output:

0
25855
513884
451446
379664
463677
147972
259014
115396
537065
61376
510191
95200
328777
282337
199131
72153
405843
215292
529082
413220
99569
275396
215884
52889
281825
182731
64473
510973
545141
417123
190844
319517
483688
15462
490221
521781
384795
539004
457181
146029
122086
1730
31958
265013
7...

result:

ok 2000 lines

Test #65:

score: 16
Accepted
time: 135ms
memory: 19408kb

input:

0 0 0 1 0 1 1 1 1 -1
0 0 0 0 1 0 1 0 1 -1
0 0 0 0 0 1 1 1 1 -1
0 0 0 0 0 1 0 0 1 -1
0 0 0 0 0 0 1 1 1 -1
0 0 0 0 1 1 0 1 0 -1
0 0 0 0 1 1 0 0 1 -1
0 0 0 0 1 0 1 0 0 -1
0 0 0 0 0 1 1 1 0 -1
0 0 0 0 0 1 0 0 0 -1
0 0 0 0 1 0 1 1 1 -1
0 0 0 0 1 0 0 0 1 -1
0 0 0 0 1 1 0 1 1 -1
0 0 0 0 1 0 1 1 0 -1
0 0 0 ...

output:

-1
0 0 0 0 0 0 0 1 1 0 1 0 1 1 1 1 0 0 1 0 0 0 0 0 0 0 1 1 0 -1
1 0 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 1 1 0 -1
1 0 1 0 1 1 1 0 1 0 0 0 0 0 0 0 0 0 1 0 -1
0 0 0 0 0 0 0 0 0 1 1 0 0 0 0 0 0 1 0 0 -1
0 1 1 0 0 0 1 1 1 0 0 0 0 0 0 0 0 0 0 1 -1
0 0 1 1 0 1 1 1 1 0 0 0 0 0 0 0 0 1 0 1 -1
1 1 1 0 1 0 1 1 1 0 1...

input:


output:

0
6187
1398
17
6163
4742
4598
2337
2237
6475
6001
5268
2245
6132
4925
1482
4253
1962
6642
2449
2704
3396
5449
2492
706
835
1879
3203
6855
4265
546
1231
2390
2300
4651
1353
1673
6724
6753
360
4275
6749
3400
1385
2945
6010
5339
226
2511
4558
1033
4708
4330
1882
1185
3535
5071
3843
1252
110
6571
6727
3...

result:

ok 2000 lines

Test #66:

score: 16
Accepted
time: 138ms
memory: 17448kb

input:

0 0 0 0 0 0 1 1 0 -1
1 1 1 0 1 1 1 0 0 1 0 0 0 0 0 1 1 1 0 0 -1
0 0 0 0 0 0 1 1 0 0 0 1 1 1 0 0 1 1 1 1 0 0 0 0 1 0 0 1 0 -1
0 0 0 0 0 0 1 0 0 0 1 1 0 0 1 0 0 0 1 0 0 0 0 0 1 0 1 0 0 -1
0 0 0 0 0 0 1 1 1 1 0 0 0 1 1 0 1 0 1 0 0 0 0 1 1 0 1 0 0 -1
0 0 0 0 0 0 0 1 1 1 0 1 1 0 0 1 0 1 1 1 0 0 0 1 0 1 1...

output:

-1
0 0 1 0 1 0 1 0 0 -1
0 0 0 0 0 0 1 0 0 0 1 1 0 1 0 0 1 1 0 0 0 0 0 1 0 0 0 0 0 -1
0 0 0 0 0 0 1 1 1 0 1 0 0 0 1 1 1 0 0 1 0 0 0 0 1 0 0 1 1 -1
0 0 0 0 0 0 0 1 0 1 0 1 1 0 0 0 1 1 1 0 0 0 0 0 0 1 1 0 1 -1
0 0 0 0 0 0 1 0 1 0 1 1 1 0 1 1 1 0 1 0 0 0 0 0 1 1 0 0 0 -1
0 0 0 0 0 0 1 1 1 0 0 0 1 1 0 1 ...

input:


output:

0
5455
4313
3996
4463
4115
2413
1141
7939
4669
5854
7806
7612
3394
7713
441
4956
1630
751
2070
4241
6754
3518
3736
3158
549
4590
6798
842
1597
7637
3679
6104
7953
5654
3951
1877
2075
5983
6633
5724
2967
2362
527
7670
3759
3471
4089
508
1187
5437
3533
3003
7429
7499
5966
7484
949
1545
1862
542
3370
1...

result:

ok 2000 lines

Test #67:

score: 16
Accepted
time: 6ms
memory: 3964kb

input:

1 1 1 1 1 1 1 1 1 -1
0 1 1 0 1 1 0 0 1 -1
0 1 1 0 1 0 0 1 0 -1
0 0 0 1 1 0 1 0 1 1 0 0 0 1 0 1 0 0 1 1 1 0 1 1 1 0 1 0 0 -1
1 0 0 0 0 1 1 0 0 -1
0 0 1 1 0 0 0 0 0 -1
0 0 1 0 0 0 0 0 0 1 0 1 1 1 1 1 0 1 1 1 0 0 1 1 0 1 0 1 1 -1
0 0 1 0 1 0 0 1 0 0 1 1 1 1 1 1 0 0 1 0 0 0 1 0 0 0 1 1 0 -1
0 0 0 1 1 0 ...

output:

-1
0 0 0 1 0 0 1 1 0 1 0 0 1 1 0 1 0 0 1 0 0 0 0 0 0 0 1 1 1 -1
1 0 0 0 0 1 1 0 0 1 1 0 0 0 0 1 0 1 1 1 -1
1 0 0 0 0 1 1 1 1 1 0 0 1 0 0 1 1 1 0 1 -1
0 0 1 1 0 1 0 0 0 1 1 0 0 0 1 1 0 1 0 0 0 0 1 1 0 1 1 1 0 -1
0 1 0 0 1 0 0 1 0 1 1 0 0 0 1 0 0 0 0 0 -1
0 0 1 0 1 0 1 1 0 0 0 0 0 1 0 1 1 0 0 1 -1
0 0...

input:


output:

0
79964
82066
44473
18072
2475
28130
2301
83230
113642
81093
59249
90195
50231
85467
74291
46729
16457
25617
101432
68900
35355
33610
23903
86700
47102
83338
7583
34127
133107
110021
37732
129633
45351
60945
72461
55392
52316
130881
124675
30075
15677
88599
133475
132928
36589
62634
64887
16069
1161...

result:

ok 1999 lines

Test #68:

score: 16
Accepted
time: 3ms
memory: 4056kb

input:

1 0 1 0 0 0 1 1 0 -1
0 0 1 1 0 0 1 1 0 -1
0 0 1 0 0 1 1 0 0 1 0 0 0 1 1 1 1 0 0 0 0 0 0 1 1 1 1 1 0 -1
0 0 0 0 1 1 1 0 0 1 1 0 0 1 1 1 1 0 1 0 0 1 1 1 1 1 0 1 1 -1
0 1 1 0 0 0 1 0 0 1 1 0 1 0 1 0 1 0 1 1 0 0 0 1 0 0 1 0 0 -1
1 0 1 1 1 1 1 0 0 1 0 0 0 0 1 0 0 0 1 1 -1
0 0 0 1 1 0 1 1 1 0 1 0 0 0 0 1 ...

output:

-1
0 1 1 1 0 0 0 0 0 0 1 1 1 1 0 0 1 1 1 0 0 0 0 0 1 1 0 1 0 -1
0 0 1 0 0 1 1 1 1 0 1 0 0 1 1 0 1 1 1 0 -1
0 0 0 1 0 0 0 1 0 0 1 1 1 0 0 0 0 0 1 0 0 0 1 0 0 0 0 0 1 -1
0 0 0 1 0 0 1 0 1 1 1 0 1 0 1 1 0 0 0 0 0 1 1 1 0 1 1 1 1 -1
0 0 0 1 0 1 0 1 1 -1
0 1 0 0 0 0 1 0 0 -1
0 0 0 0 1 0 0 1 1 0 1 0 0 1 1...

input:


output:

0
81210
110050
50642
104226
59724
60918
119031
76124
48620
77571
1857
65880
90141
65835
4852
60501
41056
123150
118092
118764
86077
14093
4836
53192
92937
34284
131362
17774
106321
132310
77441
39681
134091
79245
47785
103442
13343
5323
120560
71244
18713
10453
66703
33335
66532
36476
67032
55259
13...

result:

ok 2000 lines

Test #69:

score: 16
Accepted
time: 269ms
memory: 32504kb

input:

0 0 0 0 0 0 0 1 0 -1
0 0 0 0 0 0 0 1 0 -1
0 0 0 0 0 0 0 0 1 -1
0 0 0 0 0 0 0 0 1 -1
0 0 0 0 0 0 0 0 0 -1
0 0 0 0 0 0 0 0 1 -1
0 0 0 0 0 0 0 0 1 -1
0 0 0 0 0 0 0 0 1 -1
0 0 0 0 0 0 0 0 0 -1
0 0 0 0 0 0 0 0 0 -1
0 0 0 0 0 0 0 0 0 -1
0 0 0 0 0 0 0 0 0 -1
0 0 0 0 0 0 0 0 0 -1
0 0 0 0 0 0 0 0 0 -1
0 0 0 ...

output:

-1
0 0 0 0 0 0 0 0 1 1 0 1 1 1 0 0 1 0 0 0 0 0 0 0 0 0 0 0 1 -1
0 1 1 1 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 -1
0 0 1 0 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 1 -1
1 0 1 0 0 0 0 1 1 0 1 0 0 0 0 0 0 0 0 0 -1
1 0 0 1 1 1 0 0 1 1 1 0 0 0 0 0 0 0 0 0 -1
1 0 0 1 1 1 0 0 1 0 0 0 0 0 0 0 0 0 0 0 -1
0 1 0 0 0 0 1 0 1 0 0...

input:


output:

0
11
7
13
11
12
12
8
9
4
13
7
6
10
10
12
10
4
10
11
9
13
9
12
9
10
12
11
14
9
9
11
10
6
8
9
13
10
9
9
12
11
8
12
10
9
11
11
10
13
11
11
9
11
15
10
9
10
12
10
12
12
10
9
8
8
8
9
8
6
10
10
15
11
10
10
14
9
9
11
12
10
9
10
12
13
8
8
9
11
11
9
13
11
10
10
9
10
13
9
12
10
12
10
11
9
10
14
9
9
11
13
11
11...

result:

ok 2000 lines

Test #70:

score: 16
Accepted
time: 243ms
memory: 27916kb

input:

0 0 0 0 0 0 1 0 0 -1
0 0 0 0 0 0 0 0 1 -1
0 0 0 0 0 0 0 0 1 -1
0 0 0 0 0 0 0 0 0 -1
0 0 0 0 0 0 0 0 0 -1
0 0 0 0 0 0 0 0 0 1 1 0 1 1 1 0 1 0 0 1 0 0 0 0 0 0 0 0 0 -1
1 1 0 1 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 -1
1 1 0 0 0 1 1 1 0 0 1 0 0 0 0 0 0 0 0 1 -1
0 0 0 0 0 0 0 0 0 -1
0 0 0 0 0 0 0 0 0 -1
0 0 0 ...

output:

-1
0 0 0 0 0 0 0 0 1 1 0 1 0 0 1 1 1 0 1 0 0 0 0 0 0 0 0 0 0 -1
0 0 0 0 1 1 0 1 1 1 1 0 0 0 0 0 0 0 0 1 -1
1 1 1 0 0 1 1 0 0 1 0 0 0 0 0 0 0 0 0 0 -1
1 0 0 0 0 1 1 1 1 0 1 0 0 0 0 0 0 0 0 0 -1
0 0 1 1 1 0 1 1 1 1 0 0 0 0 0 0 0 0 0 1 -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...

input:


output:

0
63
45
54
44
54
54
66
57
57
75
49
63
30
51
47
57
24
53
41
42
43
53
38
40
35
49
45
35
39
28
35
35
43
46
45
49
44
49
46
43
43
57
55
42
45
53
41
35
37
45
61
12
45
53
49
47
57
46
51
47
47
25
56
54
46
44
41
51
53
39
45
29
50
58
54
55
32
40
54
50
63
45
29
60
41
37
55
56
57
54
48
34
62
42
33
39
51
48
37
3...

result:

ok 2000 lines

Test #72:

score: 16
Accepted
time: 4ms
memory: 4192kb

input:

0 0 0 1 0 1 1 1 0 -1
0 1 1 1 0 0 0 0 1 1 0 0 0 1 1 1 1 0 0 1 -1
0 0 1 1 1 0 0 0 1 -1
0 0 0 0 0 0 1 0 0 0 1 0 1 1 1 0 1 1 1 1 0 0 0 1 1 1 1 0 1 -1
0 0 0 0 1 1 1 1 1 -1
0 0 0 0 1 0 1 1 0 -1
0 0 0 0 0 0 1 1 0 0 1 1 0 1 0 1 0 1 0 0 0 0 0 0 1 0 0 0 0 -1
0 0 0 0 0 0 1 1 1 -1
0 0 0 0 0 0 0 1 1 1 0 0 1 0 0 ...

output:

-1
0 0 0 1 1 0 1 1 0 -1
0 0 0 0 0 1 0 0 0 0 1 1 1 1 1 1 1 1 0 0 0 0 0 0 0 1 0 1 0 -1
0 0 0 0 1 1 1 1 0 1 1 0 0 0 0 1 1 0 1 0 -1
0 0 0 0 1 0 1 1 0 0 1 0 0 1 0 1 1 0 1 0 0 0 0 0 0 1 0 0 1 -1
1 1 0 1 1 1 0 0 0 1 1 0 0 0 0 0 0 0 0 0 -1
1 0 0 0 1 0 1 1 1 0 0 0 0 0 0 0 1 0 1 0 -1
0 0 0 0 0 0 1 0 0 0 1 1 0...

input:


output:

0
357
143
399
403
368
359
301
369
488
453
291
527
428
277
386
381
391
329
531
440
439
429
373
403
512
488
362
351
458
499
255
387
288
393
451
422
453
455
429
337
368
439
545
406
495
269
256
420
350
412
409
292
315
493
327
282
414
369
421
240
437
330
330
324
367
321
390
211
368
473
313
351
295
511
37...

result:

ok 2000 lines

Extra Test:

score: 0
Extra Test Passed