QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#339954#67. Two Transportationsahihi123452 131ms30620kbC++204.4kb2024-02-28 09:26:562024-02-28 09:26:58

详细

Subtask #1:

score: 0
Wrong Answer

Test #1:

score: 0
Wrong Answer
time: 6ms
memory: 3968kb

input:

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

input:


output:


result:

wrong answer 1st lines differ - expected: '0', found: ''

Subtask #2:

score: 0
Wrong Answer

Test #7:

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

input:

0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -1
0 0 0 0 0 0 0 0 0 0 0 -1
-1

output:

-1
0 -1
-1
-1

input:


output:

0

result:

ok single line: '0'

Test #8:

score: 0
Wrong Answer
time: 6ms
memory: 3912kb

input:

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

output:

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

input:


output:


result:

wrong answer 1st lines differ - expected: '0', found: ''

Subtask #3:

score: 0
Wrong Answer

Test #14:

score: 0
Wrong Answer
time: 9ms
memory: 3972kb

input:

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

output:

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

input:


output:


result:

wrong answer 1st lines differ - expected: '0', found: ''

Subtask #4:

score: 38
Accepted

Test #24:

score: 38
Accepted
time: 0ms
memory: 4176kb

input:

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

output:

-1
0 -1
1 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 1 0 0 1 1 0 0 1 1 0 0 1 0 0 0 1 -1
1 0 0 0 0 0 0 0 0 0 0 0 1 1 0 0 0 0 0 0 1 0 0 0 0 1 1 0 0 1 1 0 -1
1 0 0 0 0 0 0 0 0 0 0 0 1 1 0 1 1 0 1 1 0 0 0 0 1 0 1 0 1 1 1 0 -1
0 -1
1 0 0 0 0 0 0 0 0 0 0 1 0 1 1 0 0 0 0 0 1 0 0 0 0 0 1 1 1 0 0 1 -1
1 0 0 0 0 0 0 0 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: 3ms
memory: 4144kb

input:

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

output:

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

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: 30ms
memory: 11032kb

input:

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

output:

-1
0 -1
0 -1
0 -1
0 -1
0 -1
0 -1
0 -1
0 -1
0 -1
0 -1
0 -1
0 -1
0 -1
0 -1
0 -1
0 -1
0 -1
0 -1
0 -1
0 -1
0 -1
0 -1
0 -1
0 -1
0 -1
0 -1
0 -1
0 -1
0 -1
0 -1
0 -1
0 -1
0 -1
0 -1
0 -1
0 -1
0 -1
0 -1
0 -1
0 -1
0 -1
0 -1
0 -1
0 -1
0 -1
0 -1
0 -1
0 -1
0 -1
0 -1
0 -1
0 -1
0 -1
0 -1
0 -1
0 -1
0 -1
0 -1
0 -1
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: 0ms
memory: 3924kb

input:

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

output:

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

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: 23ms
memory: 9208kb

input:

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

output:

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

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: 12ms
memory: 4172kb

input:

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

output:

-1
0 -1
0 -1
1 0 0 0 0 0 0 0 0 0 0 1 0 0 1 1 0 1 1 0 0 0 0 0 1 1 0 0 0 1 0 0 -1
0 -1
1 0 0 0 0 0 0 0 0 0 1 0 0 1 1 1 0 0 1 0 1 0 0 0 0 1 0 1 1 1 1 1 -1
0 -1
1 0 0 0 0 0 0 0 0 0 1 1 1 1 0 1 0 1 0 0 0 0 1 0 1 0 0 1 0 0 1 1 -1
0 -1
1 0 0 0 0 0 0 0 0 1 0 1 0 0 0 0 1 0 1 0 1 0 1 0 1 1 0 0 1 1 0 1 -1
0 -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: 0ms
memory: 3940kb

input:

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

output:

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

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: 3ms
memory: 3920kb

input:

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

output:

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

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: 44ms
memory: 7836kb

input:

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

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: 3836kb

input:

0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -1
0 0 0 0 0 0 0 0 0 0 0 -1
-1

output:

-1
0 -1
-1
-1

input:


output:

0

result:

ok single line: '0'

Subtask #5:

score: 14
Accepted

Test #38:

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

input:

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

output:

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

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: 3856kb

input:

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

output:

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

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: 2ms
memory: 3868kb

input:

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

output:

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

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: 26ms
memory: 9168kb

input:

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

output:

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

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: 21ms
memory: 3948kb

input:

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

output:

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

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: 33ms
memory: 9424kb

input:

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

output:

-1
0 -1
0 -1
1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 1 0 0 0 1 0 0 0 1 0 1 0 -1
0 -1
1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 1 0 0 1 0 0 1 -1
0 -1
1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 0 0 0 0 1 1 1 0 0 1 1 0 0 1 -1
0 -1
1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 0 1 1 0 0 1 1 1 0 0 0 1 0 0 -1
0 -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: 7ms
memory: 4208kb

input:

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

output:

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

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: 5ms
memory: 3948kb

input:

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

output:

-1
0 -1
0 -1
0 -1
1 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 0 0 0 0 1 0 1 0 1 1 1 0 0 1 0 0 -1
0 -1
1 0 0 0 0 0 0 0 0 0 0 0 1 1 0 1 1 1 1 1 1 0 1 1 1 1 1 0 1 1 0 1 -1
1 0 0 0 0 0 0 0 0 0 0 0 1 1 1 0 1 1 0 1 0 0 1 0 0 0 1 1 1 1 1 1 -1
0 -1
1 0 0 0 0 0 0 0 0 0 0 1 0 1 0 1 0 0 1 0 1 0 1 0 1 0 1 0 0 1 1 1 -1
1 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: 67ms
memory: 9360kb

input:

0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -1
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 -1
0 0 0 1 1 0 0 0 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
1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 0 1 0 0 0 1 0 1 0 1 0 1 1 -1
0 -1
1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 0 1 0 1 0 1 1 0 0 0 0 0 1 1 0 -1
0 -1
0 -1
1 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 1 0 1 0 1 0 0 0 0 1 1 1 1 1 1 0 -1
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: 0
Wrong Answer

Test #51:

score: 0
Wrong Answer
time: 12ms
memory: 3880kb

input:

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

output:

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

input:


output:


result:

wrong answer 1st lines differ - expected: '0', found: ''

Subtask #7:

score: 0
Wrong Answer

Test #64:

score: 0
Wrong Answer
time: 4ms
memory: 4012kb

input:

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

output:

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

input:


output:


result:

wrong answer 1st lines differ - expected: '0', found: ''