QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#189376#5276. K-Shaped FiguresqiuzxAC ✓282ms3880kbC++172.8kb2023-09-27 13:46:052023-09-27 13:46:06

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

2
5
0 0 0 10
0 5 3 10
0 5 3 0
0 5 7 4
0 5 6 2
8
0 0 10 10
3 4 4 4
4 4 4 5
3 4 4 4
7 7 7 8
7 7 8 7
5 5 4 6
5 5 3 7

output:

6
2

result:

ok 2 number(s): "6 2"

Test #2:

score: 0
Accepted
time: 0ms
memory: 3712kb

input:

10
3
-1 -1 0 -1
-1 -1 0 -1
-1 -1 1 1
3
1 -1 0 0
0 -1 1 1
0 1 1 -1
3
0 -1 1 1
-1 1 1 -1
1 1 -1 0
3
-1 0 0 1
-1 1 0 1
-1 1 -1 0
3
-1 1 1 1
1 0 0 -1
1 -1 -1 0
3
0 -1 0 0
1 -1 0 0
-1 -1 1 1
3
1 0 1 1
1 -1 1 0
0 -1 -1 0
3
1 1 0 -1
-1 0 0 1
0 1 -1 0
3
1 0 0 -1
1 0 1 -1
1 0 0 0
3
-1 -1 -1 0
1 -1 1 0
1 0 0 -1

output:

0
0
0
0
0
1
0
0
0
0

result:

ok 10 numbers

Test #3:

score: 0
Accepted
time: 0ms
memory: 3796kb

input:

10
3
-3 2 -2 -1
3 -2 3 -4
3 4 2 5
3
0 -1 5 2
-4 -2 -1 5
1 4 5 -4
3
-3 5 -5 -5
-5 -4 -1 -3
-1 -5 -5 -1
3
-3 3 3 5
1 5 -4 5
2 -5 4 -5
3
4 2 -4 1
1 -5 1 4
-3 5 0 -3
3
3 -3 4 -2
-4 0 -5 -2
-5 2 -1 -4
3
4 -3 2 5
-3 -5 1 -4
5 2 0 5
3
-5 4 -4 -2
-5 -2 -5 2
2 4 -2 -5
3
2 -2 -4 0
2 4 0 -5
-4 -3 0 -4
3
2 5 1 ...

output:

0
0
0
0
0
0
0
0
0
0

result:

ok 10 numbers

Test #4:

score: 0
Accepted
time: 1ms
memory: 3700kb

input:

10
3
17 -61 16 46
-77 4 48 29
-83 -85 64 -98
3
8 87 72 94
-48 72 -53 -78
-55 95 76 6
3
58 -2 -20 -59
57 20 -50 -7
24 -51 -87 38
3
-20 43 38 73
-13 -14 28 -67
-26 -100 -45 55
3
18 -23 85 -71
-31 -30 7 -54
68 -33 -78 -21
3
-71 36 -11 -53
-43 -2 27 -31
-24 -30 10 71
3
-4 -26 74 -83
12 -86 -73 -58
50 -8...

output:

0
0
0
0
0
0
0
0
0
0

result:

ok 10 numbers

Test #5:

score: 0
Accepted
time: 0ms
memory: 3724kb

input:

10
3
-747205 986354 -977580 581513
-666338 455489 -636199 888600
-729203 319266 -350608 -89261
3
-449879 -106071 923151 488259
-503807 220920 -120026 346138
110986 442433 -18303 -189764
3
-620049 -67194 -918363 -449594
848473 640562 267788 -183468
846086 972796 -635121 98853
3
-762212 49768 -558584 ...

output:

0
0
0
0
0
0
0
0
0
0

result:

ok 10 numbers

Test #6:

score: 0
Accepted
time: 4ms
memory: 3720kb

input:

3333
3
1 0 0 0
1 1 -1 0
1 0 0 0
3
-1 0 1 0
1 0 1 -1
1 0 0 -1
3
-1 -1 0 -1
-1 -1 0 0
1 -1 1 1
3
1 1 0 -1
-1 0 0 0
0 0 1 0
3
-1 1 -1 0
-1 0 0 1
-1 -1 1 -1
3
0 -1 1 0
1 1 -1 -1
0 1 1 0
3
0 0 1 0
0 1 1 1
0 -1 0 0
3
1 1 -1 1
0 -1 -1 1
1 0 -1 0
3
1 1 -1 0
-1 1 1 0
0 0 -1 -1
3
-1 -1 -1 1
0 0 1 -1
-1 -1 1 1...

output:

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

result:

ok 3333 numbers

Test #10:

score: 0
Accepted
time: 4ms
memory: 3728kb

input:

3333
3
-73 -76 -14 11
90 73 50 -86
-90 64 -21 72
3
51 -82 -53 -63
-46 -40 -98 19
-33 -40 -13 -59
3
43 -81 4 76
41 -73 -88 -35
67 -8 21 25
3
-10 50 21 -96
5 36 -33 41
62 0 83 2
3
-20 22 33 63
-77 33 -69 -60
-69 -76 -87 -76
3
-9 80 -11 -53
-84 -100 59 -35
-78 67 -50 27
3
40 43 10 57
48 -31 58 82
22 53...

output:

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

result:

ok 3333 numbers

Test #11:

score: 0
Accepted
time: 5ms
memory: 3712kb

input:

3333
3
232210 724757 335359 -161206
-238348 644627 -349886 -46780
144753 304435 749031 494839
3
290483 -710209 121411 -413497
-811398 -54746 952122 -662175
-358336 475418 62077 209829
3
348229 607039 87835 824258
813712 -949811 829674 706963
638510 -881066 943199 890958
3
817602 715218 -96044 -56956...

output:

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

result:

ok 3333 numbers

Test #12:

score: 0
Accepted
time: 5ms
memory: 3696kb

input:

1000
10
1 0 0 0
-1 0 0 0
-1 -1 0 -1
0 1 1 0
-1 -1 1 -1
0 0 1 1
0 -1 1 1
-1 -1 0 1
0 0 -1 1
0 -1 1 0
10
1 0 1 -1
-1 0 1 0
0 1 1 0
1 0 1 -1
1 -1 1 0
1 -1 0 0
-1 1 1 1
0 0 1 1
-1 1 -1 0
0 0 0 1
10
-1 -1 0 1
-1 -1 -1 1
-1 1 1 -1
-1 1 -1 -1
-1 1 -1 0
-1 1 0 1
-1 0 -1 -1
0 1 0 -1
-1 -1 1 1
-1 0 1 -1
10
-1...

output:

1
2
0
0
0
1
1
2
3
0
0
0
0
0
2
2
3
2
0
0
1
0
0
0
0
0
1
1
2
0
28
0
0
0
0
0
0
0
0
5
0
0
2
0
1
1
0
3
0
10
0
4
2
1
1
0
0
0
1
0
0
1
1
0
0
1
1
4
5
0
0
1
0
5
1
1
3
0
0
3
0
2
0
0
8
0
0
1
0
0
0
1
4
0
2
0
3
1
0
0
3
2
0
0
0
3
2
0
0
5
0
0
5
1
0
1
7
0
0
1
1
1
8
0
0
0
0
0
0
2
0
0
1
0
0
1
0
3
2
2
7
1
1
2
3
2
3
0
0
...

result:

ok 1000 numbers

Test #13:

score: 0
Accepted
time: 5ms
memory: 3712kb

input:

1000
10
2 -2 -1 -2
-2 0 2 2
0 1 0 2
-1 1 0 1
-1 -2 2 2
1 -1 -2 -1
0 2 1 2
-2 2 2 2
-2 -2 0 1
1 -2 1 -1
10
2 0 -1 1
1 0 -2 2
-1 -1 0 2
0 -2 1 2
-1 1 1 2
1 1 2 1
1 1 -2 2
2 1 -1 1
2 1 -2 2
-2 1 1 2
10
0 -2 -2 -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
1
1
0
1
2
0
0
0
0
0
0
...

result:

ok 1000 numbers

Test #15:

score: 0
Accepted
time: 5ms
memory: 3724kb

input:

1000
10
5 1 5 -1
3 -4 5 4
-3 -3 5 -3
3 4 3 0
2 1 0 4
-2 4 3 2
-5 0 -1 4
-4 4 5 5
-4 5 5 1
3 2 3 -4
10
2 -1 -5 -3
-4 2 -4 0
-2 0 1 4
3 4 -5 5
4 -2 5 -5
-5 3 -5 -2
-3 5 4 2
2 -5 -5 -4
2 1 -3 -3
-3 3 -1 3
10
5 0 4 -4
-3 -4 5 3
-1 5 1 0
2 -5 4 2
-5 3 3 3
1 1 -3 1
3 -3 0 0
1 5 3 1
-1 -1 4 3
-4 -2 -1 1
10...

output:

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

result:

ok 1000 numbers

Test #16:

score: 0
Accepted
time: 4ms
memory: 3732kb

input:

1000
10
-81 -37 27 69
18 -90 -63 83
26 -83 -64 39
83 -31 -86 7
51 42 23 -50
100 0 52 -91
-24 32 -27 -93
-55 -5 -87 98
93 35 19 6
-20 21 30 -4
10
-82 4 -32 4
23 -4 99 1
-28 -78 95 0
95 34 67 -19
94 -74 -55 -70
-36 -89 15 96
65 50 -19 14
-45 -21 -13 -43
-91 -24 27 -93
-7 82 5 72
10
90 -20 -3 74
-53 -9...

output:

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

result:

ok 1000 numbers

Test #17:

score: 0
Accepted
time: 5ms
memory: 3712kb

input:

1000
10
707733 -556932 863167 188983
68093 883038 -523956 862355
447574 517286 -603738 12440
-44529 -487126 -44070 -341163
-556494 203231 -444122 614902
-949453 -616680 132221 -520744
85944 844890 -2105 796735
-515274 387669 -125589 133256
-279264 -478187 -74903 -822160
726839 -290815 754081 238246
...

output:

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

result:

ok 1000 numbers

Test #18:

score: 0
Accepted
time: 5ms
memory: 3740kb

input:

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

output:

1416
2459
716
1837
1612
1473
1330
1901
1646
2007
2216
2310
1915
1018
2194
1257
1139
1437
2265
1671
1245
1808
2182
1721
2454
1740
1830
2096
1433
1208
1246
1859
1141
1451
1631
1636
1472
1930
1328
2170
1307
1586
2022
1483
1346
1508
1665
1335
1045
1212
1799
1873
2130
1705
1993
1331
1621
1826
1206
1606
1...

result:

ok 100 numbers

Test #19:

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

input:

100
100
0 2 0 0
-1 2 1 -1
1 -2 0 2
0 2 0 1
1 2 0 1
-2 0 2 -1
-2 -1 2 1
0 0 2 -2
-2 -2 0 0
2 1 2 0
-1 -1 2 2
-1 -1 -2 0
0 2 2 -1
-2 1 0 0
1 1 2 0
0 1 2 0
-2 1 0 0
2 2 0 -2
2 -2 1 -1
-2 2 2 0
-1 2 -2 -1
-2 2 2 1
2 -2 1 2
0 1 2 2
1 1 1 -1
-1 0 0 -1
-1 -2 0 1
-1 0 2 1
-2 -1 -1 -2
1 2 1 -1
2 1 1 1
-1 2 1...

output:

827
600
712
457
698
849
478
738
690
791
460
637
391
814
820
767
709
889
568
832
623
828
687
578
600
606
1025
646
430
671
683
536
447
962
534
523
685
859
518
804
693
620
565
649
473
791
612
633
490
713
759
847
482
723
470
725
617
732
680
686
1025
918
544
857
928
867
607
684
958
445
953
652
681
786
81...

result:

ok 100 numbers

Test #20:

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

input:

100
100
-1 -3 1 3
-3 -2 2 1
-1 -1 -1 3
-2 -3 3 2
-1 3 -1 0
-1 -1 -1 1
-3 0 1 2
3 3 -3 0
2 3 -3 -2
0 3 -2 1
1 -2 2 1
0 -1 3 1
-1 1 3 -1
2 0 -3 -1
3 -1 -3 -3
-2 -2 -3 2
-3 1 3 0
-3 3 -1 3
2 -1 -1 3
2 1 1 -1
-3 3 -3 -2
3 -2 3 0
1 -1 -3 1
1 3 1 -2
1 3 0 -1
-2 -1 1 0
3 0 -2 1
-2 2 -2 3
-2 -1 1 2
1 2 3 -2...

output:

227
162
382
152
283
226
203
328
312
313
239
208
229
231
308
317
201
331
254
234
346
281
265
230
222
320
415
272
204
252
240
292
280
216
213
265
222
223
255
217
195
187
232
378
266
290
222
141
319
324
209
338
172
312
245
408
334
170
315
355
264
206
425
227
256
291
331
113
314
270
360
408
197
282
302
...

result:

ok 100 numbers

Test #21:

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

input:

100
100
-5 4 -5 -5
1 1 2 -2
2 0 3 -4
-3 0 0 3
-1 -1 -1 -3
4 -3 2 -3
4 -2 1 -2
5 -4 0 4
-5 -1 -3 0
3 0 -3 -5
-3 5 2 1
3 -1 -2 0
1 -2 -2 -1
-4 4 5 -1
-5 2 3 5
4 -4 -2 5
2 1 1 -4
3 5 -2 5
5 -5 3 5
3 0 -5 4
-4 4 -5 0
4 3 -3 -3
1 2 -2 -2
0 5 -4 3
-2 5 -4 -5
3 -2 3 0
-2 2 -1 3
4 -2 -1 -1
5 1 -2 -4
-2 3 4 ...

output:

46
101
71
89
67
36
68
137
48
79
92
52
112
58
68
51
55
63
62
62
51
82
63
61
101
68
80
57
51
75
108
63
68
60
81
106
95
59
56
59
94
76
80
115
69
87
98
86
52
36
54
73
77
39
55
67
77
86
48
68
88
70
111
70
46
36
73
53
31
79
89
81
68
60
57
115
48
87
80
65
38
58
92
87
77
41
76
81
80
52
86
66
99
43
167
53
52...

result:

ok 100 numbers

Test #22:

score: 0
Accepted
time: 7ms
memory: 3768kb

input:

100
100
-84 -92 19 -8
-5 -45 98 -88
67 -21 -97 -78
41 -5 -41 -43
-39 65 -15 63
-40 -59 11 7
-55 -38 12 -52
-34 -71 -9 34
-29 -66 54 -99
-37 -43 -100 91
-30 -45 35 -80
-88 48 -43 24
-98 -49 47 62
-94 15 67 38
75 -62 -70 58
37 34 43 93
-20 93 99 -11
-22 90 99 70
-59 -34 47 -10
72 -78 1 -60
-12 36 -18 ...

output:

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

result:

ok 100 numbers

Test #23:

score: 0
Accepted
time: 7ms
memory: 3712kb

input:

100
100
-98638 225635 357945 -62503
594854 -376508 -284287 -261261
-973554 -174291 -101939 -545390
-553498 -357731 -341552 773471
-98840 424051 -863787 792215
-203496 -170606 970526 161347
523886 636459 41663 -281463
92 560351 -455508 226905
321343 -94412 423559 -810680
414569 647593 555629 -70290
5...

output:

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

result:

ok 100 numbers

Test #24:

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

input:

10
1000
-1 1 1 -1
0 1 1 0
1 0 1 -1
1 1 1 -1
1 0 -1 -1
-1 0 0 0
-1 -1 1 0
-1 1 0 1
0 1 0 -1
1 -1 -1 -1
-1 0 1 1
0 1 1 0
0 0 1 -1
1 1 0 -1
-1 1 1 1
-1 -1 1 1
1 1 -1 0
0 0 -1 -1
1 1 0 0
1 -1 0 1
0 1 1 1
1 1 -1 1
1 1 -1 1
0 0 0 -1
-1 0 1 0
1 -1 1 1
-1 0 1 0
-1 1 1 1
1 0 -1 1
1 0 1 1
1 1 0 0
1 1 0 0
-1 -...

output:

1737797
1594271
1713514
1781504
1593707
1632002
1680399
1731213
1930935
1440704

result:

ok 10 numbers

Test #25:

score: 0
Accepted
time: 12ms
memory: 3852kb

input:

10
1000
-2 -2 0 -2
2 2 -1 -2
2 2 -2 -2
-2 -1 -2 -2
-1 1 0 1
-1 1 1 0
2 -2 -1 1
2 -2 -1 -1
2 2 -1 1
2 -1 -1 0
0 2 -2 1
1 0 -2 -1
1 -2 1 1
2 1 -1 -1
0 0 -1 2
2 1 -2 2
-1 2 -2 1
-1 0 0 0
0 0 2 -2
-1 1 1 -2
0 2 1 2
1 -2 1 0
2 0 0 2
-1 1 2 1
-1 0 -2 0
-1 1 -1 0
1 -2 2 -2
1 1 2 1
-2 2 0 1
1 0 2 2
-1 -1 1 ...

output:

722935
746226
680940
634492
736540
699343
679979
783183
667962
673500

result:

ok 10 numbers

Test #26:

score: 0
Accepted
time: 15ms
memory: 3800kb

input:

10
1000
-1 1 3 2
-2 3 2 0
2 1 3 1
2 3 1 1
1 -3 0 -1
0 3 -2 -3
-2 -1 -2 2
0 0 1 -2
1 1 0 2
-3 2 -2 2
0 -3 -1 1
-3 -3 2 -1
-1 3 0 -3
3 1 -3 -2
-2 -1 -3 2
0 2 2 -3
3 3 3 0
2 0 -2 -1
0 -1 1 2
2 2 0 -2
-2 3 0 -3
0 -3 1 0
2 -3 -2 2
-3 -3 1 1
1 3 3 -2
-2 3 -1 3
2 -2 1 3
-1 3 0 -3
0 1 2 -2
1 -2 -3 2
-1 -2 1...

output:

299570
308269
290907
264415
261421
247904
304793
278099
288701
288442

result:

ok 10 numbers

Test #27:

score: 0
Accepted
time: 15ms
memory: 3844kb

input:

10
1000
0 3 5 0
-2 -2 -1 -1
0 -4 5 -2
-2 -4 4 5
-5 1 -3 -5
-4 -1 -4 2
-3 -5 2 4
4 4 0 -1
-1 -1 3 3
-2 -1 2 -4
-1 -3 -1 -2
1 -2 2 -5
0 5 3 3
0 -4 0 1
-2 -5 -4 -5
-5 -1 2 -1
1 0 2 3
-3 -4 2 2
-1 0 0 -1
2 -3 5 5
3 -1 3 3
-4 -5 -5 0
2 -4 4 -1
5 -3 -4 3
-1 0 0 5
-3 4 5 0
-4 -1 -2 0
2 -4 -5 -3
4 2 1 -1
4 ...

output:

67389
73481
75956
73349
70649
68453
70949
75789
66922
65244

result:

ok 10 numbers

Test #28:

score: 0
Accepted
time: 32ms
memory: 3848kb

input:

10
1000
-3 0 3 -11
4 -77 18 -90
-83 -82 -9 -97
-77 93 -99 80
-85 12 -12 -21
8 -28 13 24
-43 34 -62 -77
26 88 -41 -65
67 37 -46 100
56 35 -75 3
-19 -25 -17 -14
-36 -92 -18 48
-74 -34 -4 -100
-55 31 75 -18
-3 -13 -9 -51
21 32 -31 -82
-6 1 76 46
50 -59 33 -19
73 78 58 28
-12 34 -32 50
-99 -92 -83 -79
4...

output:

1
3
6
2
3
3
3
1
0
3

result:

ok 10 numbers

Test #29:

score: 0
Accepted
time: 25ms
memory: 3772kb

input:

10
1000
-614802 -499794 68495 -938424
-135905 191478 452826 906219
134298 -109129 -90665 -783649
-691692 -499991 62620 802041
-69632 -142199 24205 -735075
736055 -88141 -837999 526174
-981844 -174647 951468 -266455
512130 431535 382050 470305
723970 770577 -830119 528504
920011 -921720 -958184 59054...

output:

0
0
0
0
0
0
0
0
0
0

result:

ok 10 numbers

Test #30:

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

input:

1000
10
162601 -248689 32991 642673
-789919 -468425 519796 -166288
390186 725074 -340789 -595131
32991 642673 227406 -694370
757926 -111354 -551789 -413491
281666 -221222 -432724 -386024
97796 196992 162601 -248689
-340789 -595131 243991 461033
-340789 -595131 243991 461033
32991 642673 162601 -2486...

output:

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

result:

ok 1000 numbers

Test #31:

score: 0
Accepted
time: 7ms
memory: 3772kb

input:

1000
10
220970 -304412 -55621 601654
298 570505 141373 -343385
220970 -304412 493574 -45376
-277208 4763 56728 204949
220970 -304412 -804004 776206
56728 204949 -945080 -395609
220970 -304412 -277208 4763
56728 204949 385212 -813773
-945080 -395609 223696 305042
220970 -304412 56728 204949
10
16348 ...

output:

2
5
0
0
4
0
2
0
12
8
0
0
1
0
0
0
0
2
0
0
0
2
0
0
0
0
1
8
5
0
0
0
3
2
0
0
2
0
0
0
2
0
3
0
0
0
0
0
0
5
2
0
0
2
0
0
0
0
0
0
2
0
0
0
0
0
0
0
0
0
0
0
0
0
2
3
0
0
6
3
0
3
10
0
0
0
4
0
2
0
0
3
0
0
0
0
0
0
0
0
7
2
0
0
0
0
4
0
0
7
0
0
1
0
0
3
0
0
0
7
0
0
0
6
0
0
0
0
0
1
0
0
0
0
2
0
0
0
1
1
0
0
1
1
0
1
0
0
0
...

result:

ok 1000 numbers

Test #32:

score: 0
Accepted
time: 3ms
memory: 3712kb

input:

1000
10
-972677 -205221 522113 -358231
867580 -963814 -770966 695336
48307 -134239 969799 -136237
933 -372590 -881547 -79133
-293227 -274771 48307 -134239
-293227 -274771 -249091 356485
-791903 -139117 328377 -132613
-819781 -283559 233327 -265983
-416736 -797932 556964 383180
-531900 -32610 555093 ...

output:

4
8
2
0
0
0
1
0
0
0
0
0
4
0
4
0
0
0
0
0
0
1
1
0
9
1
4
2
0
0
0
2
1
1
0
2
2
0
2
0
1
1
0
2
0
0
10
0
0
0
0
1
2
2
0
2
0
0
0
0
10
0
0
4
0
1
4
3
0
1
3
0
0
2
0
0
0
5
5
0
3
0
0
2
0
3
0
3
0
2
0
2
0
2
0
13
0
0
2
3
2
0
0
2
4
0
1
1
0
0
0
0
2
0
0
0
0
3
0
0
0
1
3
0
0
0
0
0
0
0
0
4
0
0
2
0
0
2
2
0
0
0
0
2
7
2
0
0
0...

result:

ok 1000 numbers

Test #33:

score: 0
Accepted
time: 13ms
memory: 3724kb

input:

100
100
123480 836988 15946 -187886
256489 -409613 -70369 875174
13511 249275 224565 -700529
616193 143648 -729010 -352591
-287746 -520128 167792 -21765
-192930 848386 120384 -706022
-17541 -297518 116407 141010
13511 249275 224565 -700529
-979759 -551915 907454 970346
-23675 691633 163101 -42531
-7...

output:

1116
333
637
775
990
542
729
989
693
458
1351
295
1543
671
930
984
678
605
931
292
947
469
690
857
853
1043
911
850
876
682
1251
937
640
1540
679
357
644
422
310
586
807
915
609
799
557
1185
1056
1627
423
963
369
581
690
625
385
757
1093
688
788
930
737
842
993
524
978
611
801
548
1157
731
1236
428
...

result:

ok 100 numbers

Test #34:

score: 0
Accepted
time: 12ms
memory: 3656kb

input:

100
100
118926 767870 310856 -215678
-244071 -236234 210767 -147831
-518689 -305928 453919 -95132
179826 -773928 363268 7622
17946 58046 -506088 -530514
-599693 355808 861501 -511898
-489856 327098 911390 -622760
612315 -856894 -143477 585842
815179 -573640 -963936 714907
764518 -551549 -142806 1201...

output:

452
515
284
350
257
657
369
666
405
542
303
327
537
260
748
465
567
522
316
290
409
251
677
545
292
280
779
808
355
264
484
758
304
543
549
543
569
432
378
517
317
363
366
914
906
516
333
334
333
577
527
512
215
713
563
460
652
402
106
909
672
392
749
551
512
560
280
840
947
748
465
439
400
540
583
...

result:

ok 100 numbers

Test #35:

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

input:

100
100
-287661 148492 421707 -922624
-226899 -41511 469941 -427200
-29858 518029 474295 -277127
-635970 -202586 176751 616596
-724604 -328212 377541 -66082
-682879 -582883 229081 499861
-287661 148492 153513 -267658
307749 994320 -283746 -223360
961027 618702 -486689 78432
277543 -42627 -1157 54858...

output:

402
131
335
242
79
343
220
217
82
128
252
219
98
158
298
200
281
188
256
303
201
173
282
151
231
150
249
291
254
112
126
135
305
65
206
126
236
189
223
157
109
138
112
150
180
233
73
112
127
100
275
210
190
216
364
168
356
154
128
163
210
199
139
146
360
343
247
106
384
189
319
263
150
178
211
257
1...

result:

ok 100 numbers

Test #36:

score: 0
Accepted
time: 4ms
memory: 3772kb

input:

100
100
144211 403853 112309 -593598
-132108 -174153 -251800 426119
243372 305097 -180803 148528
-493155 62521 144759 77535
393585 308610 -330260 -92940
343814 764584 -47292 -105698
743231 423714 -854729 -265596
-623185 -539330 946496 342720
-137003 -294514 777591 88166
148261 329443 -304383 -902777...

output:

48
10
17
24
16
44
23
25
23
21
11
21
10
6
12
25
19
27
6
37
32
22
38
9
29
19
17
23
30
15
42
44
12
10
32
15
11
46
22
10
27
51
22
19
15
33
17
27
36
12
16
14
10
9
11
22
15
25
18
16
19
23
44
22
10
30
44
13
27
6
18
23
11
18
24
18
21
48
9
32
24
25
11
32
29
23
14
12
12
31
18
3
11
43
21
22
24
14
25
31

result:

ok 100 numbers

Test #37:

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

input:

100
100
854876 -96331 -111286 -67435
826968 -200379 -901011 -77542
-635028 227019 224648 -139609
-77807 -513471 280183 593310
169129 -486499 -645881 869801
-9401 -933483 -508085 991563
-206854 -419063 4602 332982
467086 -713251 79492 255467
180729 -489240 232377 686500
704894 184619 -806422 -427581
...

output:

6
11
21
19
21
18
9
7
12
6
21
6
11
7
9
24
11
9
16
18
13
11
9
21
44
32
15
3
18
6
2
11
7
10
11
9
14
10
14
19
16
22
8
8
12
7
8
19
22
24
15
17
14
22
4
2
12
4
16
16
1
9
16
30
15
9
8
8
21
5
7
6
10
16
1
12
17
8
8
6
7
11
13
8
12
7
7
13
8
9
6
6
20
5
14
26
19
6
29
52

result:

ok 100 numbers

Test #38:

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

input:

100
100
-485392 810204 411926 -65787
183669 -44054 484559 -254321
547020 -126646 -986652 76431
-305576 336185 -299122 -858456
-184921 4611 219227 -499191
-13902 508614 -688830 -738950
138542 316312 -680324 -859170
220019 -217200 788951 -827498
212975 -175605 483005 372069
133997 222468 -442657 -7968...

output:

4
7
3
6
6
10
1
0
0
1
1
1
10
3
3
5
5
5
2
3
0
1
3
10
2
6
0
7
8
0
0
16
9
6
5
4
14
1
4
1
3
2
1
3
2
4
5
1
7
10
4
7
4
4
1
9
2
1
1
5
2
3
2
6
6
4
2
9
3
2
2
9
0
6
6
8
20
8
2
0
1
7
2
2
12
3
3
2
1
8
1
6
0
9
10
4
1
4
4
1

result:

ok 100 numbers

Test #39:

score: 0
Accepted
time: 31ms
memory: 3832kb

input:

10
1000
-721528 -688723 729089 215019
-483870 9145 622350 -32903
590768 -904436 -555207 714414
-44185 400133 344815 -426755
-333195 -389961 -187665 358167
417821 -958947 -361786 852051
308064 253981 -285566 -564944
449584 -345332 -879289 362986
759127 -642907 -703818 717058
448601 -488689 -978539 88...

output:

10085
10998
8953
12209
9234
10157
10666
9357
10982
11932

result:

ok 10 numbers

Test #40:

score: 0
Accepted
time: 31ms
memory: 3880kb

input:

10
1000
-996834 597125 908682 -503197
-923601 -24338 764897 309912
244182 -199252 -93622 8337
-195620 -367985 549516 600195
-111282 148527 233235 -742548
340440 -875835 -635585 813760
126074 -25494 119511 -353106
-822210 844085 955110 -894810
-111282 148527 310433 -15260
235128 200528 411112 -144890...

output:

5603
5953
5539
6855
5470
6334
4991
6459
4750
7410

result:

ok 10 numbers

Test #41:

score: 0
Accepted
time: 30ms
memory: 3716kb

input:

10
1000
-178258 254193 437996 -179355
748794 624494 -917846 -907911
-147746 -267812 -570352 -732510
-251190 -294949 -39309 83717
297403 58450 356267 561054
-408876 -139416 679992 -415620
-772174 -606504 997856 535974
749092 622028 -779678 -747367
52032 69166 -509903 -663467
-194149 99248 -544389 -91...

output:

2459
1986
2376
2468
2213
2299
2416
1991
2344
2026

result:

ok 10 numbers

Test #42:

score: 0
Accepted
time: 29ms
memory: 3776kb

input:

10
1000
608880 313038 -788064 28466
-7829 230534 -634203 -365206
178451 -792508 374336 700112
-515132 747837 399601 -709095
858965 -180434 -591913 462028
296416 458008 91808 -476850
55041 -201985 9277 721953
-440105 539305 268039 82967
534249 194620 -408831 282043
330929 -107873 -4753 584731
200934 ...

output:

286
242
250
213
251
191
211
242
176
236

result:

ok 10 numbers

Test #43:

score: 0
Accepted
time: 25ms
memory: 3880kb

input:

10
1000
415905 -958272 -175740 647593
83365 32820 257415 512676
-329832 -704197 567053 710612
-756395 -576663 -68687 494225
667015 -199437 -384665 356805
-707999 -715051 321802 137018
-440815 563529 977321 -913629
-29992 -293239 306641 307340
226345 659120 -299597 -421843
-99722 17970 20591 388776
-...

output:

126
153
117
170
161
135
110
128
121
94

result:

ok 10 numbers

Test #44:

score: 0
Accepted
time: 29ms
memory: 3768kb

input:

10
1000
-992075 -183730 536275 362425
302781 -518710 -857575 238178
-711055 -905921 -35567 890280
892623 174243 -797957 8388
560051 372135 -714861 -52277
164096 -306986 198344 932282
222477 -422656 277143 312476
476360 433553 -744652 82393
-873976 723688 -244081 -2777
678703 -458305 -216595 -142867
...

output:

51
42
41
48
51
66
64
37
51
47

result:

ok 10 numbers

Test #45:

score: 0
Accepted
time: 282ms
memory: 3796kb

input:

10
1000
-254736 -111657 265198 215309
5231 51826 332758 184086
5231 51826 126095 690388
5231 51826 137377 446870
88538 -268692 -161383 692862
244820 974551 -74632 -255749
-617830 916333 420605 -524512
5231 51826 998948 -779501
795161 226102 -609159 -83722
-856996 983272 867458 -879620
-432661 -82042...

output:

8324536
8955345
7902397
8885528
9263974
8305575
8728147
8510355
9440287
9152964

result:

ok 10 numbers

Test #46:

score: 0
Accepted
time: 141ms
memory: 3792kb

input:

10
1000
-27806 303559 -12200 -225653
346827 -189873 -203418 153366
-478112 240127 132700 -28105
380784 591093 -239426 -956902
-331145 -254131 135568 185495
-813776 229991 448192 -114137
-46932 -189851 312332 133641
206270 -656317 22345 914213
-166324 -653353 431724 597143
896215 -363395 -478112 2401...

output:

2143466
3483766
3488996
1947716
3896106
2642183
2202319
3144631
1507320
2321125

result:

ok 10 numbers

Test #47:

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

input:

10
1000
0 -1000000 0 1000000
0 0 1000000 1
-2 -1000000 2 1000000
0 0 1000000 3
-4 -1000000 4 1000000
0 0 1000000 5
-6 -1000000 6 1000000
0 0 1000000 7
-8 -1000000 8 1000000
0 0 1000000 9
-10 -1000000 10 1000000
0 0 1000000 11
-12 -1000000 12 1000000
0 0 1000000 13
-14 -1000000 14 1000000
0 0 1000000...

output:

62375000
62375000
62375000
62375000
62375000
62375000
62375000
62375000
62375000
62375000

result:

ok 10 numbers