QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#487668#8786. The Whole Worlducup-team4435WA 313ms12296kbPython32.0kb2024-07-23 06:26:062024-07-23 06:26:07

Judging History

你现在查看的是最新测评结果

  • [2024-07-23 06:26:07]
  • 评测
  • 测评结果:WA
  • 用时:313ms
  • 内存:12296kb
  • [2024-07-23 06:26:06]
  • 提交

answer

#!/usr/bin/python3

def has_int_solution(A, b):
    N = len(A)
    if N == 0:
        return True

    M = len(A[0])
    col = 0
    for row in range(N):
        non_zero = M
        for j in range(col, M):
            if A[row][j] != 0:
                non_zero = j
        
        if non_zero == M:
            if b[i] != 0:
                return False
            continue
        
        if non_zero != col:
            for i in range(row, N):
                A[i][col], A[i][non_zero] = A[i][non_zero], A[i][col]

        for j in range(col, M):
            if A[row][j] < 0:
                for i in range(row, N):
                    A[i][j] *= -1

        assert A[row][col] > 0

        for j in range(col + 1, M):
            while A[row][j] != 0:
                K = A[row][col] // A[row][j]
                for i in range(row, N):
                    A[i][col] -= A[i][j] * K
                    A[i][col], A[i][j] = A[i][j], A[i][col]

        if b[row] % A[row][col] != 0:
            return False

        K = b[row] // A[row][col]
        for i in range(row + 1, N):
            b[i] -= A[i][col] * K

        col += 1
    
    return True

choose = [[0 for j in range(100)] for i in range(100)]
for i in range(len(choose)):
    choose[i][0] = 1
    choose[i][i] = 1
    for j in range(1, i):
        choose[i][j] = choose[i - 1][j] + choose[i - 1][j - 1]

def solve():
    n = int(input())
    points = []
    for i in range(n):
        points.append(tuple(map(int, input().split())))
    
    points.sort()

    def check(deg):
        A = [[choose[points[i][0]][j] for j in range(deg + 1)] for i in range(n)]
        b = [points[i][1] for i in range(n)]
        return has_int_solution(A, b)

    lb = -1
    rb = 31
    while not check(rb):
        rb *= 2

    while rb - lb > 1:
        mid = (lb + rb) // 2
        if check(mid):
            rb = mid
        else:
            lb = mid

    print(rb)

for _ in range(int(input())):
    solve()

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 9ms
memory: 10832kb

input:

2
2
1 0
4 1
3
1 1
4 4
6 6

output:

3
1

result:

ok 2 number(s): "3 1"

Test #2:

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

input:

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

output:

3
3

result:

ok 2 number(s): "3 3"

Test #3:

score: 0
Accepted
time: 9ms
memory: 10956kb

input:

2
10
1 557
2 -172
3 -497
5 763
6 -149
7 -355
8 -29
9 -588
10 -171
11 -355
10
1 -461
2 -219
3 -45
4 -212
5 749
6 -294
9 -85
10 213
11 -412
12 125

output:

10
11

result:

ok 2 number(s): "10 11"

Test #4:

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

input:

20
10
1 -193165761
4 426322868
5 -408198139
7 -455731045
9 -389028341
17 -590246653
18 119481348
21 809814532
23 47591392
26 -21020402
10
3 -715116939
5 -263142266
6 -426687860
10 342227448
14 141724722
15 576758779
18 123410194
19 256532828
20 -223524833
25 386574889
10
5 34943085
7 238431559
9 168...

output:

25
22
23
20
20
25
23
25
26
23
23
25
29
23
24
29
29
27
25
19

result:

ok 20 numbers

Test #5:

score: 0
Accepted
time: 150ms
memory: 11100kb

input:

100
10
1 158027281
3 -154375927
6 -515683907
9 -801063453
15 371607728
16 -30224647
24 -215349633
26 219182013
29 -87257968
30 186925822
10
2 205585983
9 740879281
11 -672242855
14 -53907640
16 146130715
20 -17941862
25 -424140108
26 593743162
27 -8310423
28 84863497
10
3 46810292
4 361101002
5 4687...

output:

29
25
25
20
19
25
20
29
29
19
25
19
26
26
27
21
27
26
25
25
24
26
27
25
25
27
26
23
27
23
29
25
27
26
28
29
29
20
21
23
22
25
23
16
25
29
26
25
26
18
23
18
23
19
28
19
26
26
24
18
26
19
23
27
21
23
17
26
28
25
27
23
16
19
25
26
23
25
14
23
20
20
25
23
24
23
19
19
20
20
22
26
26
25
22
23
28
17
19
19

result:

ok 100 numbers

Test #6:

score: 0
Accepted
time: 112ms
memory: 11072kb

input:

100
30
1 -519015304
2 269671593
3 -163533023
4 830108438
5 337806976
6 -87888761
7 -195233355
8 -341350273
9 38092088
10 285610643
11 -240058763
12 256373103
13 297741964
14 -247379404
15 -26410774
16 -755197562
17 -643221179
18 159031836
19 689848941
20 622207228
21 -407862690
22 401550934
23 10884...

output:

29
29
29
29
29
29
29
29
29
29
29
29
29
29
29
29
29
29
29
29
29
29
29
29
29
29
29
29
29
29
29
29
29
29
29
29
29
29
29
29
29
29
29
29
29
29
29
29
29
29
29
29
29
29
29
29
29
29
29
29
29
29
29
29
29
29
29
29
29
29
29
29
29
29
29
29
29
29
29
29
29
29
29
29
29
29
29
29
29
29
29
29
29
29
29
29
29
29
29
29

result:

ok 100 numbers

Test #7:

score: 0
Accepted
time: 144ms
memory: 11132kb

input:

100
29
1 149105603
2 19193029
3 -254160491
4 -298710412
5 -329725675
6 644578442
7 611132722
8 -806708763
9 506813970
10 566271854
11 -621025393
12 293347092
13 -332652769
14 -320671582
15 507576094
16 -153368460
17 -242687628
18 545685752
19 -359086703
20 -31631637
21 34200734
22 695203819
23 66205...

output:

29
29
29
29
29
29
29
29
29
29
29
29
29
29
29
29
29
29
29
29
29
29
29
29
29
28
29
29
29
29
29
29
29
29
29
29
29
29
29
29
29
29
29
29
29
29
29
29
29
29
29
29
29
29
29
29
29
29
29
29
29
29
29
29
29
29
29
29
29
29
29
29
29
29
29
29
29
28
29
29
29
29
29
29
29
28
29
29
29
29
28
29
29
29
29
29
29
29
28
29

result:

ok 100 numbers

Test #8:

score: 0
Accepted
time: 177ms
memory: 11036kb

input:

100
27
1 -219694090
2 313611706
3 19681553
4 -393439728
5 137039465
6 -210242538
7 -257014477
8 711593910
9 -126342644
10 317378740
12 -27880234
14 -312500245
15 -611623850
16 26965932
17 -344751802
19 25604908
20 -925684523
21 218732296
22 -906235432
23 128008760
24 128339229
25 -373435576
26 78643...

output:

29
29
29
29
29
29
29
29
29
28
28
29
29
29
28
29
29
29
29
29
29
29
29
29
29
28
28
29
29
29
29
29
29
29
29
29
29
29
29
28
29
29
29
29
29
29
29
29
28
29
28
29
29
29
29
28
29
29
29
28
29
29
29
29
28
28
29
28
29
29
29
29
29
29
29
29
29
29
29
29
29
29
29
28
29
29
28
29
28
29
29
29
29
29
29
29
29
29
28
29

result:

ok 100 numbers

Test #9:

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

input:

100
26
1 66877446
2 -164941227
3 225463507
4 184131912
5 102090525
7 758317818
8 -97450001
9 370239141
11 3046899
13 323733227
14 -130439971
16 -635446409
17 -859978167
18 48284039
19 -447989609
20 -127277242
21 557802358
22 101519428
23 62166242
24 -314606125
25 -689141632
26 -358169960
27 -4857611...

output:

29
29
28
29
29
29
28
29
29
29
29
29
29
28
29
29
28
28
29
29
29
29
29
29
28
29
28
27
29
27
28
29
29
29
29
29
28
29
29
28
29
28
29
29
29
29
28
28
29
29
29
29
29
29
29
29
29
29
28
29
28
29
28
27
29
29
28
29
29
29
29
29
29
29
29
29
29
29
29
28
29
28
29
29
29
29
29
29
29
29
29
28
29
28
29
29
28
28
29
29

result:

ok 100 numbers

Test #10:

score: 0
Accepted
time: 199ms
memory: 11004kb

input:

100
25
1 348246102
2 -750467389
3 -68044274
4 -686461116
5 -293360003
7 -262211929
8 669230593
9 -78704756
10 609746050
11 41527955
12 -497959309
14 -647052946
15 -588566559
16 -19571993
18 -540729853
19 146529178
20 -814716222
21 28809002
22 -486593284
24 330571691
25 -313603881
26 757285671
27 -65...

output:

29
29
27
29
27
29
28
29
28
28
29
29
28
29
29
29
29
29
29
29
29
29
29
29
29
29
29
29
29
29
29
29
27
28
29
29
29
29
29
28
29
29
28
27
28
29
29
29
27
28
29
27
28
28
29
29
29
28
28
29
29
28
29
28
29
29
29
27
28
29
29
29
28
29
28
29
29
29
29
28
28
29
27
29
29
28
29
29
27
29
29
27
29
29
29
29
29
28
29
29

result:

ok 100 numbers

Test #11:

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

input:

100
24
1 232880847
2 -489768736
4 -535788421
5 -109001398
6 -632734245
8 -411753361
10 275051825
11 577581411
12 -81737036
13 -221509120
14 -561678665
15 365478690
19 -324173702
20 208854667
21 -387192388
22 -649434295
23 291048454
24 344365482
25 76539150
26 126031273
27 -396021296
28 -344960240
29...

output:

29
29
29
29
26
28
29
26
28
29
29
29
29
29
27
29
28
25
28
29
28
29
29
29
29
27
29
28
29
27
29
28
29
28
28
27
29
29
29
28
29
29
29
28
27
28
28
29
27
29
27
29
29
29
29
29
27
28
28
28
29
29
29
28
28
28
29
29
29
27
28
28
29
29
29
27
28
28
26
29
28
26
29
29
27
29
29
29
29
29
29
27
29
29
29
27
28
29
27
27

result:

ok 100 numbers

Test #12:

score: 0
Accepted
time: 221ms
memory: 11188kb

input:

100
23
1 478739509
2 359667718
3 -882444045
4 57243210
5 -383836266
7 697287195
8 794293697
9 596461407
10 -376755911
11 -342210915
14 -307035202
15 516844954
16 273425410
17 622517588
18 331049509
20 291385046
21 441000840
23 301865030
25 -47497896
26 454086322
27 -700208571
28 75982830
30 86810034...

output:

29
29
29
29
27
28
28
29
29
29
29
28
29
27
29
28
27
28
29
28
27
27
29
29
29
27
29
28
29
29
27
27
29
29
29
29
29
27
29
29
28
29
29
29
28
28
27
29
29
29
28
29
28
29
29
29
29
29
28
29
28
27
28
28
29
27
29
29
28
29
29
29
27
28
29
28
29
29
28
27
27
29
27
29
29
29
28
27
28
27
29
28
29
28
29
27
28
27
26
29

result:

ok 100 numbers

Test #13:

score: 0
Accepted
time: 235ms
memory: 11032kb

input:

100
22
1 82224311
2 380989415
3 -57663623
4 11085277
5 -582683316
8 -471665926
9 -6237828
10 207354682
11 -637027084
12 -377093059
15 -525136114
17 -487354995
18 547677692
19 -4946643
21 585507148
22 -819450009
23 700393091
24 -382069257
27 687298238
28 -217201782
29 -213847359
30 -618012461
22
1 -1...

output:

29
27
29
29
28
29
27
28
29
28
29
27
29
27
29
27
29
29
29
29
29
29
29
29
28
28
29
27
29
29
28
29
28
29
29
27
26
29
26
29
28
29
29
29
29
28
27
29
29
29
27
29
29
29
27
29
27
29
28
26
27
27
29
28
29
28
26
29
28
29
27
29
29
29
29
29
28
29
27
29
29
29
28
29
28
29
27
27
28
27
28
29
29
29
29
28
29
29
29
29

result:

ok 100 numbers

Test #14:

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

input:

100
21
1 230002188
2 183945321
3 651536456
4 -643918753
5 211711257
6 654169344
7 -36956799
10 -563182976
11 780329888
12 83318851
14 680921670
16 144574582
17 -412078292
20 59369731
22 191902719
23 -168624389
25 -230822751
26 162445773
28 529054626
29 349224830
30 60377140
21
1 -116191033
3 9358547...

output:

29
25
29
26
29
29
29
27
29
29
29
29
29
29
29
29
26
29
29
29
27
29
26
29
28
29
28
27
29
28
29
27
29
27
29
27
29
28
29
29
27
29
29
28
28
29
28
26
29
29
28
29
27
29
27
28
29
29
29
27
29
27
26
28
27
29
29
28
26
29
29
29
29
29
29
26
27
28
26
28
29
27
27
27
26
28
29
29
29
27
27
29
29
28
27
29
27
27
26
27

result:

ok 100 numbers

Test #15:

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

input:

100
20
1 79862239
2 13563425
3 442926139
4 751723600
5 -388108679
6 340056379
7 265769938
8 264356154
9 -767173552
10 677960143
11 -417566533
12 -109239724
13 -217075453
14 -431467593
15 283334122
16 -184655006
17 -583644166
18 687896311
19 -428898891
20 -153559940
20
1 45135061
2 -402948599
3 -3068...

output:

19
19
19
19
19
19
19
19
19
19
19
19
19
19
19
19
19
19
19
19
19
19
19
19
19
19
19
19
19
19
19
19
19
19
19
19
19
19
19
19
19
19
19
19
19
19
19
19
19
19
19
19
19
19
19
19
19
19
19
19
19
19
19
19
19
19
19
19
19
19
19
19
19
19
19
19
19
19
19
19
19
19
19
19
19
19
19
19
19
19
19
19
19
19
19
19
19
19
19
19

result:

ok 100 numbers

Test #16:

score: 0
Accepted
time: 75ms
memory: 11048kb

input:

100
19
1 -181371540
2 13240092
3 314423105
5 -394312316
6 -234691535
7 -361087288
8 -86290439
9 380662523
10 441658935
11 53438172
12 730947574
13 63208482
14 366463967
15 -421649955
16 777637605
17 885895472
18 825604443
19 -300184228
20 -242061244
19
1 -361908907
2 -299110845
3 680021944
4 9035898...

output:

19
19
19
19
18
19
19
19
19
19
19
19
19
19
19
19
19
19
19
19
18
19
19
18
19
18
19
19
19
19
19
18
18
19
19
19
19
19
19
19
19
19
19
19
19
19
18
19
19
19
19
19
19
19
19
19
19
19
19
19
19
19
19
19
19
19
19
19
19
19
19
19
19
19
19
19
19
19
19
18
19
19
19
19
18
19
19
19
19
19
18
19
19
19
18
19
19
19
18
19

result:

ok 100 numbers

Test #17:

score: 0
Accepted
time: 82ms
memory: 11032kb

input:

100
18
1 -354653395
2 42066904
4 -68276768
5 -192085395
6 58560317
7 -207318090
8 537360505
9 40763183
10 156146366
11 -429382519
12 322008688
13 -28358871
14 609666646
15 -9538294
16 703168906
18 -72298640
19 477629958
20 -13376890
18
1 202247530
3 -69182766
4 318152992
5 -103746478
6 188766430
7 -...

output:

19
18
19
18
19
19
19
19
19
19
19
19
19
17
19
18
19
19
18
19
19
19
19
19
19
19
19
19
19
19
19
19
19
19
18
18
18
19
18
19
19
19
19
19
18
19
19
19
18
18
18
18
19
19
19
18
19
18
19
19
19
19
19
19
19
19
19
19
19
19
19
18
19
18
19
19
19
19
19
19
19
19
19
19
18
18
19
19
19
19
19
18
19
19
19
18
19
19
19
18

result:

ok 100 numbers

Test #18:

score: 0
Accepted
time: 93ms
memory: 10972kb

input:

100
17
1 -520284730
2 -514466075
3 79886711
4 -425878138
5 180732260
6 55285306
8 345562838
9 90565947
10 -355737856
12 -707405720
13 -702604328
14 461805437
15 -617984149
16 315426606
17 98275951
19 301389112
20 17753554
17
2 257428766
3 -138011315
5 -57866095
6 465506635
7 550205616
8 439902409
9 ...

output:

19
17
19
18
18
18
18
18
19
19
19
19
18
19
19
18
19
19
19
18
19
19
19
19
19
19
18
19
18
19
19
19
19
18
19
19
19
19
18
19
19
18
19
19
18
17
19
19
19
19
19
18
19
18
19
19
19
19
19
19
19
17
19
19
19
19
19
19
19
19
19
18
19
18
18
18
19
19
19
19
18
19
19
16
18
18
17
19
19
19
18
18
19
18
19
19
19
17
19
18

result:

ok 100 numbers

Test #19:

score: 0
Accepted
time: 98ms
memory: 11156kb

input:

100
16
1 -436119416
3 391185595
4 -435418162
7 -691793974
8 245585835
10 -371621633
11 210958524
12 569976178
13 768802725
14 -941519049
15 -343297444
16 511343513
17 196563299
18 -480863886
19 124725083
20 904182202
16
2 334944378
6 648051647
7 -765319693
8 -618274082
9 -103023609
10 -523171753
11 ...

output:

19
17
19
18
19
19
19
18
19
19
19
19
18
19
19
19
18
16
19
18
19
19
19
19
18
18
19
19
18
19
17
18
19
18
17
19
19
19
19
17
19
19
18
19
18
17
19
19
18
19
19
19
19
19
18
18
19
18
19
18
19
19
19
17
18
19
19
17
18
18
17
19
19
19
19
18
18
19
19
18
19
19
18
19
18
19
18
18
18
18
19
19
19
18
19
19
18
19
19
18

result:

ok 100 numbers

Test #20:

score: 0
Accepted
time: 90ms
memory: 10900kb

input:

100
15
3 393201231
4 -473082363
5 288075459
6 -781304926
8 -344605578
9 -762599458
10 148398381
11 -74721014
12 30515839
15 135235819
16 249775138
17 10438875
18 380474650
19 -188178720
20 236686798
15
1 -288477317
2 127071531
4 -144735677
5 558661851
7 399284631
9 -222168762
10 161402510
12 4769221...

output:

17
19
18
19
19
19
18
17
19
19
19
17
18
19
19
19
19
18
19
19
18
18
18
18
18
16
18
19
18
18
19
19
18
19
19
17
17
19
19
16
19
18
19
17
19
18
18
17
18
19
19
19
18
19
19
18
19
19
18
18
18
19
17
18
18
18
19
18
18
19
19
19
18
19
19
18
19
19
19
18
19
18
19
17
19
19
18
19
19
19
17
18
18
17
18
19
19
18
17
19

result:

ok 100 numbers

Test #21:

score: 0
Accepted
time: 93ms
memory: 10980kb

input:

100
14
1 -192276589
2 463022051
4 -80886076
6 217581726
7 60147874
9 910596718
10 835086587
11 271854523
12 42865965
14 -29751969
15 -113715891
18 -51572533
19 -473585126
20 -629221007
14
1 -11470255
2 81461908
4 -59304196
5 181367500
7 -159328723
9 237736152
10 -486771655
11 -395980960
14 657515062...

output:

19
19
19
19
19
17
18
19
18
18
18
18
18
18
19
19
18
17
16
19
17
18
19
18
19
18
19
16
18
18
18
17
17
17
19
19
19
19
18
17
19
17
18
17
19
17
16
18
18
19
19
18
19
18
19
16
18
16
17
18
17
19
18
19
17
17
19
18
17
19
19
18
19
19
17
17
19
19
18
18
19
19
18
18
19
18
18
17
18
17
17
18
17
19
19
19
18
17
18
18

result:

ok 100 numbers

Test #22:

score: 0
Accepted
time: 92ms
memory: 10972kb

input:

100
13
1 -863121769
3 -233128926
4 -377235222
5 -673951134
6 4136818
7 405871550
9 -260407300
12 72841502
13 244040530
15 408164919
16 287387341
17 156191482
18 134237218
13
2 57325712
4 637332399
5 -101974089
6 126851796
11 -221389590
12 175998065
13 -566603004
14 142214875
15 -57895880
16 43406090...

output:

17
18
17
18
14
19
18
17
17
16
16
18
16
19
19
16
16
19
18
19
18
19
18
18
17
18
19
18
18
17
19
17
19
19
19
19
17
19
15
18
16
19
17
18
17
16
19
19
18
17
15
19
18
17
19
19
18
19
17
16
17
18
19
19
18
19
17
17
17
19
19
19
19
19
19
19
19
18
14
16
15
19
17
19
17
17
17
19
17
19
19
17
16
18
18
17
17
17
16
18

result:

ok 100 numbers

Test #23:

score: 0
Accepted
time: 313ms
memory: 12280kb

input:

100
12
1 -446217998
7 -791225517
9 73408189
11 -106337857
15 -104940040
17 62436238
18 101915123
19 634463899
22 -682278321
24 173008410
25 13330045
28 177562882
12
4 242985533
10 -69256930
12 800744571
13 66071467
14 266447106
16 -617719069
17 -336076323
18 -352901627
19 -499160520
22 424949885
24 ...

output:

23
18
29
23
26
20
23
27
18
29
27
23
25
25
20
23
29
27
27
23
23
25
24
27
29
24
23
24
27
29
21
27
24
29
27
29
29
29
27
29
24
23
27
26
25
25
19
27
29
27
26
25
23
27
23
29
29
27
22
25
27
29
21
23
25
29
26
23
24
28
25
27
25
25
22
20
27
25
26
25
27
24
26
27
22
27
27
29
29
24
27
25
27
25
22
22
23
25
21
26

result:

ok 100 numbers

Test #24:

score: 0
Accepted
time: 292ms
memory: 12296kb

input:

100
11
2 45805640
4 -646328719
5 207358977
6 -397475219
12 74326792
14 -720327036
17 589847619
22 131060182
23 139741592
26 2049141
27 -110705785
11
1 609352575
3 47393004
4 -79755028
5 40310136
6 606700068
7 741322213
9 -403282727
20 -189581978
21 46299345
25 457503077
27 -189306816
11
1 -127398323...

output:

23
23
28
20
29
27
23
19
27
25
19
19
23
26
26
25
27
25
23
23
27
25
25
26
25
25
25
26
24
27
26
27
27
27
27
20
27
19
25
25
27
25
29
23
26
26
18
29
25
23
25
29
25
26
27
24
21
25
27
27
27
27
27
25
26
29
25
27
29
19
29
23
23
27
27
29
19
25
25
23
26
27
27
26
20
27
26
24
29
25
26
19
27
19
23
27
26
27
26
23

result:

ok 100 numbers

Test #25:

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

input:

100
10
1 633115355
2 450712493
3 285295171
4 -385532314
5 652496399
6 -197131060
7 274136810
8 -279102761
9 -197551405
10 -79996669
10
1 274699787
2 1839534
3 -616047168
4 -60250745
5 671482314
6 -19034267
7 -9658461
8 257680210
9 -123879825
10 139494956
10
1 -701307197
2 256579741
3 113557351
4 433...

output:

9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9

result:

ok 100 numbers

Test #26:

score: 0
Accepted
time: 27ms
memory: 10888kb

input:

100
9
1 728379835
2 -179894775
3 611528078
4 485044306
6 504205256
7 182192378
8 144203830
9 -892220119
10 -286299806
9
1 -110850187
2 -772285945
3 -391731848
4 -221100604
5 -544170610
6 -639452338
7 -474574210
8 -91059748
9 429472121
9
1 680136596
2 -297180692
3 944231335
5 -301605604
6 -204530001
...

output:

9
8
9
9
9
9
9
9
9
9
9
9
9
9
8
9
8
9
9
9
9
9
9
9
9
9
9
9
9
9
9
8
9
9
9
8
9
9
9
8
9
9
9
9
9
9
9
9
9
9
9
9
9
9
8
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
8
9
9
9
8
9
9
9
9
9
8
9
9
9
9
9
8
9
8

result:

ok 100 numbers

Test #27:

score: 0
Accepted
time: 35ms
memory: 10944kb

input:

100
8
1 433262671
2 -177226094
3 -299482632
4 -594522652
7 675141297
8 509392909
9 -94557217
10 150935951
8
1 -60909638
4 -467145889
5 -307071610
6 -489983289
7 -494257985
8 -50354259
9 403263924
10 -818438862
8
1 -74834113
4 -227317873
5 -287386154
6 303764118
7 -655359905
8 -181641738
9 257864068
...

output:

9
9
9
9
8
9
9
8
8
8
9
9
9
8
9
9
8
9
8
9
9
9
8
8
9
8
7
9
9
9
8
8
9
8
9
8
8
9
9
9
7
9
9
9
9
8
7
9
9
9
8
8
8
7
9
9
8
8
9
8
9
8
9
9
9
9
9
9
8
9
9
8
9
7
8
9
8
8
9
9
8
9
8
8
9
7
9
8
9
9
7
9
9
8
9
9
7
9
8
9

result:

ok 100 numbers

Test #28:

score: 0
Accepted
time: 28ms
memory: 10944kb

input:

100
7
2 234118084
3 -171914649
4 -841368580
6 -358928487
7 180927843
9 179206045
10 97940031
7
1 -463450840
3 614314602
4 -374826072
6 -564715557
7 -882123950
8 186568552
9 396225969
7
1 -392028378
2 -27838941
3 90882795
5 -575965556
6 622941654
7 15727627
10 421398285
7
1 -537342592
2 588663331
4 4...

output:

8
8
7
8
8
8
8
8
9
9
7
9
9
8
7
7
7
9
8
7
8
8
7
7
7
8
6
9
8
9
8
9
8
9
8
9
9
7
8
8
8
9
9
8
8
9
7
8
6
8
6
8
8
8
9
7
8
7
8
8
8
8
8
6
9
8
9
7
6
8
8
6
7
8
8
8
7
8
8
8
6
8
8
8
9
8
8
8
7
9
8
8
9
7
9
9
8
6
7
9

result:

ok 100 numbers

Test #29:

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

input:

100
6
2 -120937772
3 -897148699
5 -148872697
7 -102018260
8 99135699
10 316400620
6
2 -46097849
4 781069288
6 12451101
7 -149152321
8 624219690
9 -105960199
6
1 408388313
2 514436151
4 -691925334
8 504906162
9 -283566735
10 -583359909
6
3 271350159
5 139711806
7 -647661236
8 612718061
9 773355312
10...

output:

7
7
9
7
9
6
8
8
7
9
8
8
6
5
9
7
9
8
8
9
9
8
8
8
8
6
7
6
7
9
8
8
9
8
7
8
7
9
7
8
8
7
7
7
6
9
7
6
7
7
7
9
5
8
9
8
9
9
6
8
9
8
9
9
7
7
8
6
7
7
8
7
9
8
6
5
9
8
6
6
7
8
9
7
8
9
9
7
7
9
8
6
5
7
7
7
9
6
8
8

result:

ok 100 numbers

Test #30:

score: 0
Accepted
time: 21ms
memory: 10932kb

input:

100
5
3 -93496046
6 111857442
7 -387403176
8 733170096
9 91109345
5
2 -118984592
3 217556872
5 72059003
7 126376151
8 -499055262
5
2 -246206876
3 215441126
4 278565864
7 266140384
10 116779517
5
2 -217614959
3 568957624
7 -488312248
8 192376450
9 650137267
5
3 18207344
6 541390272
7 -244525904
8 -12...

output:

5
6
8
7
5
5
7
8
7
6
9
7
7
8
8
8
5
7
6
6
5
6
7
9
8
9
9
6
7
9
5
7
9
6
5
7
8
4
5
7
7
7
5
5
8
5
5
6
9
9
4
9
8
7
9
4
8
5
7
7
7
8
8
6
9
5
8
7
8
5
8
4
8
9
7
8
9
6
9
5
6
6
9
7
6
6
7
8
7
8
6
6
6
6
8
9
8
6
7
7

result:

ok 100 numbers

Test #31:

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

input:

100
4
2 -304952651
3 -710501883
8 477116963
10 122649796
4
4 -536302329
6 -57293980
8 436061711
9 -650220628
4
2 265116524
3 162495298
4 193202159
5 476686168
4
3 -294782292
5 -706826530
8 168960428
10 -336787841
4
2 429140464
4 455196906
6 -821740802
7 -139969761
4
4 -173926139
5 212112354
8 535953...

output:

8
5
3
7
4
4
4
4
5
7
9
9
4
7
9
5
4
6
4
4
4
5
8
7
5
5
6
4
5
8
8
3
5
9
8
5
7
5
9
8
8
9
5
9
7
3
8
4
8
5
5
8
5
5
7
4
9
6
6
7
9
5
7
3
4
7
7
5
7
4
5
9
7
8
5
5
9
5
6
6
4
8
9
5
4
3
8
8
5
5
6
7
8
7
4
8
8
6
4
3

result:

ok 100 numbers

Test #32:

score: 0
Accepted
time: 18ms
memory: 11012kb

input:

100
3
1 -606484896
3 125774853
7 -732645055
3
2 -217514632
3 -537717835
5 26871335
3
2 84757268
7 -30514789
8 -506974437
3
2 -517178045
6 -449532575
8 -322554872
3
5 466248934
6 625727683
7 915022
3
4 -239647274
7 -406749369
9 -371909696
3
1 90723542
2 118974409
7 -399043834
3
4 374998086
5 -1070296...

output:

4
2
5
3
2
5
5
4
8
3
3
8
4
9
7
3
9
5
8
8
5
3
2
3
2
7
3
2
5
3
3
4
7
7
5
5
5
7
5
3
2
7
5
9
3
2
5
2
3
2
3
5
9
8
2
2
4
5
2
7
7
4
7
5
7
3
3
2
4
2
3
5
4
2
4
2
5
7
4
3
3
5
3
4
5
5
4
2
2
4
3
4
2
4
3
3
5
7
8
5

result:

ok 100 numbers

Test #33:

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

input:

100
2
3 259974188
9 58991735
2
3 362209411
9 -262214921
2
4 90671436
8 535752117
2
4 290981529
9 -221276206
2
2 71865637
6 -835647829
2
1 696910349
10 -94683993
2
2 -322545744
10 240102306
2
6 -375751317
9 -197849288
2
4 934581594
6 199316122
2
3 9995565
5 275863477
2
4 142258229
5 362126820
2
8 -88...

output:

2
1
4
1
2
9
4
3
1
1
1
1
1
1
1
7
2
2
2
2
3
7
3
3
3
1
3
1
3
5
1
4
1
7
1
1
5
5
9
5
1
7
3
1
5
7
3
7
2
2
3
3
1
3
5
1
1
1
1
1
2
2
2
1
2
5
1
2
3
3
3
1
1
5
1
1
1
3
5
1
2
1
2
5
5
7
1
2
3
1
4
1
1
8
1
5
2
1
1
2

result:

ok 100 numbers

Test #34:

score: 0
Accepted
time: 17ms
memory: 10836kb

input:

100
2
13 569677587
20 -595022368
2
11 -369654745
15 708891960
2
9 79611484
14 627484420
2
3 127645756
10 72773826
2
1 322092234
6 534632371
2
14 225641967
17 736551566
2
14 636896022
15 -124511940
2
6 -272276307
14 796797672
2
4 125238276
18 -517977412
2
5 137647535
20 85872625
2
6 263291425
20 4882...

output:

7
4
5
7
5
3
1
8
7
3
7
13
5
8
2
17
3
4
3
16
4
2
1
4
7
5
3
3
1
3
2
1
3
11
1
3
2
1
1
3
1
2
11
7
4
11
3
5
5
5
3
2
7
1
1
1
3
3
1
19
11
2
1
1
4
1
5
1
11
1
7
9
16
1
17
1
1
1
1
5
3
3
1
11
1
1
13
1
3
2
5
7
1
13
2
5
1
3
13
13

result:

ok 100 numbers

Test #35:

score: 0
Accepted
time: 11ms
memory: 10900kb

input:

100
1
10 181152734
1
7 139692265
1
2 60731566
1
5 35936420
1
9 129253759
1
8 166787994
1
9 -169342620
1
4 184893003
1
8 -158561318
1
4 -278586451
1
5 562446722
1
2 123128316
1
6 -71857827
1
2 -169908542
1
7 70815251
1
6 563956695
1
8 41099855
1
1 91824585
1
8 -28106440
1
8 -671869318
1
6 -493551643
...

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 #36:

score: -100
Wrong Answer
time: 31ms
memory: 10952kb

input:

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

output:

29
29
29
29
29
29
29
29
29
29
29
29
29
29
29
29
0
0
0
0
0
0
0
0
0
0
0
0
0
29

result:

wrong answer 17th numbers differ - expected: '29', found: '0'