QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#589937#1425. DivAfterlife#WA 1664ms13136kbC++202.7kb2024-09-25 20:44:062024-09-25 20:44:09

Judging History

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

  • [2024-09-25 20:44:09]
  • 评测
  • 测评结果:WA
  • 用时:1664ms
  • 内存:13136kb
  • [2024-09-25 20:44:06]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;
int n , m;
const int D = 20;
typedef long double db;
map<int,int> mp;
const int px[] = {1000000007 , 1000000009 , 998244353} ;
const int pl = 3;

int qpow(int a,int b,int mod) {
    int ans = 1;
    while(b) {
        if(b & 1) ans = 1LL * ans * a %mod;
        a = 1LL * a * a % mod ;b >>= 1;
    }
    return ans;
}

bool check(int x) {
    vector<int> v , v2;
    for(int i = 0;i < pl;i++) {
        int p = px[i] , ans = 0;
        for(auto [a,c] : mp) {
            ans = (ans + 1LL * ((c + p) % p) * qpow(x , a , p) % p) % p;

        }
        ans = 1LL * ans * qpow((qpow(x , m , p) - 1 + p) % p , p - 2 , p)  % p;

        v.push_back(ans) ;
        v2.push_back((p - ans) % p) ;
        // printf("x = %d , ans = %d , p = %d\n",x,ans,p) ;
    }
    bool ff = 1;
    for(int i = 1;i < pl;i++) {
        if(v[i] != v[i - 1]) ff = 0;
    }
    if(ff) return 1;
    ff=1;
    for(int i = 1;i < pl;i++) {
        if(v2[i] !=  v2[i - 1]) ff = 0;
    }
    return ff;
}
typedef pair<int,int> pii;
const db eps = 1e-6;
mt19937 rnd( time(0)) ;
void solv() {
    cin >> n >> m;
    mp.clear() ;
    int ans = 0;
    int sol = 0;
    for(int i = 1;i <= n;i++) {
        int c , a;
        cin >> c >> a;
        // c = rnd()%2 ? 1 : -1 ;
        // a = rnd()%m;
        sol = (sol + c) % m;
        mp[a % m] += c; 
        mp[(a + 1) % m] -= c;
    }
    if(sol == 0) ans++ ;

    bool ff = 1;
    for(auto [x,y] : mp) {
        ff &= (y == 0) ;
    }
    if(ff) {
        cout << -1 << '\n' ; return ;
    }
    if(m <= 10) {
        for(int i = 2;i <= n*2 + 5;i++) ans += check(i) ;
        cout << ans << '\n' ; return ;
    }
    auto it = mp.lower_bound(m - D) ;
    vector<pii> coe;
    while(it != mp.end()) {
        coe.push_back(*it);
        it++ ;
    }
    // for(auto [a,c] : coe) cout << c <<' ' << a << '\n' ;
    for(int i = 2;i <= n * 2 + 5;i++) {
        if(i <= 10) ans += check(i) ;
        else {
            db sol = 0;
            int lst = D + 1;
            for(auto [a,c] : coe) {
                a = m - a;
                while(lst > a + 1) {
                    sol = sol / i ; lst-- ;
                }
                sol = (sol + c) / i; lst-- ;
            }
            while(lst > 1) {
                sol /= i ; lst-- ;
            }
            int dd = (int)(sol + 0.5) ;
            if(fabs(sol - dd) < eps && fabs(sol) > eps) {
                // cout << i <<' ' << sol << endl;
                ans += check(i);
            }
        }
    }
    cout << ans << '\n';
    return ;
}
int main() {
    ios::sync_with_stdio(false) ; cin.tie(0) ;
    int t;cin >> t;
    while(t--) solv() ;
    
}

详细

Test #1:

score: 100
Accepted
time: 0ms
memory: 3672kb

input:

3
5 2
1 0
1 0
1 0
1 0
1 0
5 3
-1 2
-1 1
-1 0
1 1
-1 1
12 3
-1 0
-1 7
1 8
1 8
-1 4
-1 6
1 8
1 2
1 5
1 2
-1 9
1 5

output:

1
-1
2

result:

ok 3 number(s): "1 -1 2"

Test #2:

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

input:

1
1 1
1 0

output:

-1

result:

ok 1 number(s): "-1"

Test #3:

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

input:

4
1 1000000000
1 0
1 1
1 1000000000
1 1000000000
-1 0
1 1
-1 1000000000

output:

0
-1
0
-1

result:

ok 4 number(s): "0 -1 0 -1"

Test #4:

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

input:

100000
1 1
-1 0
1 1
1 0
1 1
-1 1
1 1
1 1
1 1
-1 2
1 1
1 2
1 1
-1 3
1 1
1 3
1 1
-1 4
1 1
1 4
1 1
-1 5
1 1
1 5
1 1
-1 6
1 1
1 6
1 1
-1 7
1 1
1 7
1 1
-1 8
1 1
1 8
1 1
-1 9
1 1
1 9
1 1
-1 10
1 1
1 10
1 1
-1 11
1 1
1 11
1 1
-1 12
1 1
1 12
1 1
-1 13
1 1
1 13
1 1
-1 14
1 1
1 14
1 1
-1 15
1 1
1 15
1 1
-1 16...

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

result:

ok 100000 numbers

Test #5:

score: 0
Accepted
time: 346ms
memory: 3644kb

input:

50000
2 1
-1 0
-1 0
2 1
-1 0
1 0
2 1
-1 0
-1 1
2 1
-1 0
1 1
2 1
-1 0
-1 2
2 1
-1 0
1 2
2 1
-1 0
-1 3
2 1
-1 0
1 3
2 1
-1 0
-1 4
2 1
-1 0
1 4
2 1
-1 0
-1 5
2 1
-1 0
1 5
2 1
-1 0
-1 6
2 1
-1 0
1 6
2 1
-1 0
-1 7
2 1
-1 0
1 7
2 1
-1 0
-1 8
2 1
-1 0
1 8
2 1
-1 0
-1 9
2 1
-1 0
1 9
2 1
-1 0
-1 10
2 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
...

result:

ok 50000 numbers

Test #6:

score: 0
Accepted
time: 1664ms
memory: 3964kb

input:

100000
1 170035890
1 835589389
1 433027164
1 407537923
1 293860673
-1 788447900
1 838946623
1 450237482
1 629410117
1 476559978
1 171248763
1 671271287
1 468119514
1 346821429
1 112217885
-1 249186444
1 760504335
1 622839250
1 206432863
1 481956490
1 344167459
-1 251322298
1 603763257
-1 255443178
1...

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 100000 numbers

Test #7:

score: 0
Accepted
time: 1334ms
memory: 3676kb

input:

18185
6 462481634
-1 877399979
-1 444077256
1 863609811
1 737864979
-1 36285324
1 213052314
10 318224330
-1 392130699
-1 865648776
1 786577813
-1 47209814
-1 582014903
-1 552524598
1 931469640
-1 520667488
1 246701061
-1 583303124
6 255562733
-1 824922940
1 140907808
-1 659810174
1 755380312
1 78398...

output:

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

result:

ok 18185 numbers

Test #8:

score: 0
Accepted
time: 1139ms
memory: 3708kb

input:

1955
6 251705778
-1 306007602
1 338569924
1 913388465
-1 293228463
-1 357117659
-1 694618291
75 20088478
1 562896192
1 23789274
-1 419033091
1 347705574
1 640321092
-1 24823981
1 921096576
-1 107646445
-1 667736867
1 531502674
1 830022166
1 86700568
-1 138594043
1 358907049
-1 751689887
-1 1199423
1...

output:

0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
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
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
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
1
0
0
0
0
0
0
0
0
0
0
1
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 1955 numbers

Test #9:

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

input:

209
403 593744416
1 517964811
-1 181413985
-1 205129281
-1 814887706
1 968581352
1 714390388
1 635228328
-1 380906902
-1 696702331
1 6613143
1 15016617
1 431361558
1 672301213
1 135877994
1 455725955
-1 710803578
-1 530208577
1 95409526
-1 146277027
-1 504956437
-1 612977541
-1 12812223
-1 199941830...

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

Test #10:

score: 0
Accepted
time: 1141ms
memory: 4808kb

input:

24
2434 636377467
-1 770106795
1 828277555
-1 274146643
-1 441882590
-1 54415246
1 830277363
-1 331528200
-1 515652110
1 73968564
-1 377803597
-1 737019678
-1 132017335
-1 908297411
-1 856987154
-1 539087469
1 811351978
1 288732948
1 773226717
-1 738752886
1 836337764
1 332156441
-1 289537204
1 9911...

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

result:

ok 24 numbers

Test #11:

score: 0
Accepted
time: 1357ms
memory: 12932kb

input:

8
42 457808739
-1 789149347
-1 452572683
-1 456424609
-1 640853004
-1 542172406
1 451142377
1 368673199
1 694199351
-1 961486131
-1 630564272
-1 880483909
-1 665295814
-1 572092289
1 216494167
-1 129377090
1 87527349
1 423453639
-1 438434619
1 449628033
1 696689831
-1 277173
-1 321621424
1 139535963...

output:

0
0
0
0
0
0
0
0

result:

ok 8 numbers

Test #12:

score: 0
Accepted
time: 1303ms
memory: 13136kb

input:

1
100000 148857431
-1 30521050
-1 219978148
-1 929551318
-1 972784058
1 374088376
-1 76864642
1 185632011
1 95546675
1 66312268
1 305990708
1 310692844
-1 176379563
-1 609502588
-1 404411675
1 53930302
1 84483869
1 655924365
1 565254030
-1 649315722
1 658395194
-1 706455090
1 134319869
-1 626974501
...

output:

0

result:

ok 1 number(s): "0"

Test #13:

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

input:

18265
9 2
-1 442105658
-1 626353674
-1 135302128
-1 669485390
-1 519357584
-1 434878556
-1 383172206
-1 718977796
-1 306699064
6 2
-1 465453985
-1 260161269
-1 685533869
-1 574919497
-1 373616571
-1 331367241
1 2
1 958204698
8 2
1 599513965
1 163265175
1 482253857
1 483275687
1 269395687
1 862915777...

output:

2
3
0
3
1
1
1
1
3
1
1
0
1
2
0
3
3
2
3
3
1
1
1
0
0
1
1
1
1
1
2
1
1
2
2
0
3
3
1
2
1
1
1
2
3
1
3
2
0
1
1
3
3
3
1
3
1
1
3
1
0
1
2
3
1
1
1
1
1
2
1
1
3
3
3
1
1
2
1
3
2
3
3
2
2
1
3
3
3
2
1
1
2
3
1
2
1
3
1
1
3
3
3
1
3
3
1
1
3
0
1
0
1
3
2
3
1
3
2
3
3
1
1
1
1
3
1
2
1
3
3
1
1
3
1
3
1
1
2
3
1
1
1
2
3
0
1
2
3
2
...

result:

ok 18265 numbers

Test #14:

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

input:

1993
19 2
-1 413997038
-1 392515626
-1 441391298
-1 789256640
-1 980657448
-1 662676842
-1 603235098
-1 867524378
-1 580077796
-1 119876956
-1 848632762
-1 752624252
-1 170037950
-1 584737438
-1 214696690
-1 984436916
-1 835282474
-1 163126706
-1 588815190
96 2
-1 229017452
-1 241260014
-1 761524442...

output:

1
11
1
3
1
2
5
7
3
5
3
7
3
3
4
7
5
1
1
8
3
7
1
7
1
11
5
11
1
3
5
5
2
3
3
1
1
5
1
1
1
1
3
7
3
5
5
7
5
3
3
1
7
2
9
5
1
1
3
5
1
7
3
1
7
3
1
1
1
1
7
3
1
1
1
7
1
3
7
2
3
9
7
5
3
5
11
5
1
0
3
5
3
1
3
3
2
7
1
1
1
1
5
11
5
5
1
7
7
11
11
1
3
3
5
7
3
6
3
5
1
1
3
5
1
4
3
5
2
3
11
1
3
1
3
3
2
9
1
3
3
5
3
3
1
3
...

result:

ok 1993 numbers

Test #15:

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

input:

211
553 2
-1 857977150
-1 418854316
-1 246293166
-1 979119012
-1 208387930
-1 77719118
-1 706905582
-1 632365920
-1 290420498
-1 977309818
-1 991937482
-1 531934898
-1 773357998
-1 992995698
-1 345642622
-1 595739286
-1 265550566
-1 698786416
-1 797354514
-1 632364620
-1 155286688
-1 369881034
-1 26...

output:

3
11
3
1
3
7
5
3
3
5
14
1
3
3
5
9
7
3
5
3
1
23
5
7
7
3
3
3
3
3
3
5
9
7
1
3
7
3
3
7
3
1
1
7
5
3
3
3
3
1
15
1
23
3
3
3
11
7
5
11
13
3
5
1
5
5
3
19
3
7
15
15
3
1
1
7
3
5
23
7
1
3
11
3
3
1
3
7
17
3
3
11
1
1
11
9
3
5
9
11
1
11
1
3
3
5
5
3
7
15
7
1
11
7
4
7
0
19
11
1
9
1
5
3
11
7
7
5
1
5
5
1
1
7
3
11
1
3
...

result:

ok 211 numbers

Test #16:

score: 0
Accepted
time: 191ms
memory: 3704kb

input:

34
3517 2
1 540384624
1 408070698
1 511962278
1 325853702
1 251514420
1 827205084
1 275395232
1 575954632
1 179428254
1 238325658
1 923222624
1 170117046
1 530570506
1 68697240
1 838461550
1 87486488
1 323976730
1 985390548
1 734642178
1 873610300
1 132461352
1 24160116
1 889118314
1 682581518
1 191...

output:

1
3
23
5
7
1
1
0
11
15
13
20
2
7
3
1
1
3
3
7
3
7
23
7
3
11
5
3
23
2
7
2
7
3

result:

ok 34 numbers

Test #17:

score: 0
Accepted
time: 192ms
memory: 3960kb

input:

12
1 2
-1 765889228
24852 2
1 197242948
1 30278308
1 326693944
1 358779684
1 115354646
1 586817688
1 291635006
1 637069440
1 680993786
1 797782858
1 427716808
1 889234480
1 286596394
1 639667314
1 334695100
1 943129106
1 638327684
1 792528484
1 349320872
1 176350316
1 910105466
1 490279552
1 9444693...

output:

0
23
11
1
23
1
7
11
3
3
7
3

result:

ok 12 numbers

Test #18:

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

input:

1
100000 2
-1 428152556
-1 611080626
-1 10639874
-1 809865716
-1 221316278
-1 414439356
-1 689016910
-1 475414128
-1 416709600
-1 774749906
-1 45512738
-1 459712994
-1 967153322
-1 134679488
-1 367669378
-1 440582140
-1 105667180
-1 309242528
-1 365031158
-1 358746894
-1 936716530
-1 707762920
-1 36...

output:

35

result:

ok 1 number(s): "35"

Test #19:

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

input:

10
83160 2
1 421393706
1 644344662
1 322664862
1 202793482
1 756338360
1 937847120
1 764629714
1 964792384
1 14149902
1 719356
1 241699756
1 466282730
1 938344576
1 717183266
1 882751800
1 939705430
1 840304672
1 907279640
1 427307254
1 401819130
1 460153090
1 819778032
1 241428552
1 286150382
1 480...

output:

127
3
3
7
7
3
1
3
3
0

result:

ok 10 numbers

Test #20:

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

input:

21
21 3
-1 338743241
-1 703901819
-1 442748396
-1 571015286
-1 833768741
-1 676820384
-1 497296649
-1 854400152
-1 94900106
-1 237968801
-1 777811754
-1 658662173
-1 213340673
-1 156203258
-1 473475518
-1 25679474
-1 52401242
-1 387448244
-1 208834313
-1 187130315
-1 917602847
91 3
-1 133853201
-1 2...

output:

3
3
1
2
2
1
3
1
1
1
2
1
2
1
1
1
1
1
3
1
1

result:

ok 21 numbers

Test #21:

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

input:

17
69961 3
-1 15416142
-1 463968706
-1 987568270
-1 996904434
-1 713525392
-1 527976466
-1 42048030
-1 745248878
-1 480207678
-1 884649012
-1 41966364
-1 783203934
-1 677791294
-1 579052716
-1 295387344
-1 468771236
-1 974643428
-1 505170128
-1 774505312
-1 188297346
-1 639428022
-1 569706198
-1 975...

output:

0
0
0
0
0
-1
1
1
0
0
1
0
1
5
0
0
1

result:

ok 17 numbers

Test #22:

score: 0
Accepted
time: 200ms
memory: 3644kb

input:

15
121 5
-1 65492297
-1 793645367
-1 457563832
-1 962501967
-1 219926082
-1 652186722
-1 550045272
-1 485244367
-1 533761982
-1 633566197
-1 651859262
-1 570803452
-1 242539492
-1 258740262
-1 853635957
-1 164885327
-1 278862587
-1 469147267
-1 792358507
-1 142983767
-1 107057527
-1 678431047
-1 175...

output:

1
1
1
2
1
2
3
1
2
2
3
1
1
2
1

result:

ok 15 numbers

Test #23:

score: 0
Accepted
time: 181ms
memory: 3736kb

input:

23
19183 3
1 950380956
1 506886426
1 404294799
1 414871707
1 795327486
1 364266723
1 24001068
1 598202457
1 313370064
1 286835922
1 886846587
1 749440437
1 178014009
1 622784412
1 698149590
1 787772814
1 463088433
1 460292094
1 333753105
1 291964257
1 296965188
1 879577419
1 180587367
1 300885402
1 ...

output:

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

result:

ok 23 numbers

Test #24:

score: 0
Accepted
time: 200ms
memory: 3936kb

input:

16
8373 3
1 700606356
1 306095832
1 864563637
1 881383935
1 591398709
1 13639005
1 102310059
1 536646837
1 542801355
1 780680103
1 830611539
1 153607431
1 785269599
1 691347
1 632405058
1 528838614
1 150777528
1 547173891
1 880288365
1 308651625
1 633171594
1 35793294
1 892548525
1 43922736
1 307834...

output:

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

result:

ok 16 numbers

Test #25:

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

input:

17
156 4
1 449735370
1 150493826
1 570562322
1 742120314
1 416346310
1 34267982
1 136513174
1 83458030
1 825422046
1 538177366
1 775176810
1 623599042
1 866989150
1 788452406
1 675405746
1 902164630
1 189488882
1 628222486
1 62366706
1 953636050
1 162599726
1 630427986
1 95259914
1 410483210
1 93377...

output:

2
2
2
1
1
1
2
1
1
3
2
1
1
4
1
1
3

result:

ok 17 numbers

Test #26:

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

input:

18
259 4
-1 56141732
-1 488265876
-1 435207476
-1 48763364
-1 10736516
-1 952943848
-1 444500128
-1 406953696
-1 993284032
-1 251360480
-1 292837380
-1 940311628
-1 544869480
-1 296978796
-1 242156984
-1 116504476
-1 720866688
-1 518692548
-1 978081960
-1 720374336
-1 147073416
-1 363721516
-1 72509...

output:

1
1
1
6
2
2
1
1
1
3
2
1
1
3
2
2
2
2

result:

ok 18 numbers

Test #27:

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

input:

16
11155 4
-1 62599353
-1 530033701
-1 398302537
-1 628467537
-1 545162589
-1 412210053
-1 743956201
-1 73122749
-1 466606569
-1 605220965
-1 331299457
-1 157974209
-1 652375693
-1 775120193
-1 938832645
-1 637315813
-1 336295365
-1 418616953
-1 708755397
-1 582299017
-1 431677149
-1 84684477
-1 174...

output:

1
4
1
1
1
2
2
2
1
2
1
1
1
1
1
1

result:

ok 16 numbers

Test #28:

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

input:

10
21757 3
1 945991245
1 185618358
1 869942241
1 271040004
1 349124097
1 663904152
1 313449156
1 589534653
1 126768411
1 399537642
1 651081264
1 543862920
1 677832951
1 613490334
1 435188484
1 296931321
1 737179101
1 311455902
1 15894879
1 555373386
1 411338007
1 77346108
1 219449352
1 426704025
1 1...

output:

1
2
2
2
4
1
1
2
1
1

result:

ok 10 numbers

Test #29:

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

input:

20
57 3
-1 448583628
-1 685942932
-1 138385497
-1 64441824
-1 425273193
-1 296691201
-1 373893672
-1 886306464
-1 593515812
-1 791253036
-1 587798829
-1 54757956
-1 68140113
-1 966631101
-1 248774130
-1 387642747
-1 626112150
-1 973908387
-1 252318879
-1 677259597
-1 817607286
-1 828063360
-1 867081...

output:

2
3
2
2
2
2
2
1
1
2
2
2
1
1
2
1
2
2
3
1

result:

ok 20 numbers

Test #30:

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

input:

10
2163 3
1 528626525
1 176888702
1 100437266
1 985573187
1 454757810
1 11788889
1 844846373
1 48086312
1 653487233
1 643698350
1 83922740
1 735866270
1 513218456
1 122750777
1 61304792
1 104615837
1 333449435
1 480739049
1 457197779
1 586677587
1 163791689
1 725508386
1 702221867
1 120469127
1 5291...

output:

4
1
1
2
1
4
3
2
1
4

result:

ok 10 numbers

Test #31:

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

input:

24
22765 4
1 910469468
1 551109380
1 372105184
1 791105088
1 230081228
1 159253752
1 999591508
1 283788460
1 260867244
1 313435572
1 630459832
1 555594892
1 448793764
1 982798128
1 623121624
1 980057360
1 859294072
1 478380128
1 312710548
1 96747132
1 378312288
1 591014684
1 731015844
1 992630752
1 ...

output:

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

result:

ok 24 numbers

Test #32:

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

input:

17
273 3
1 438888481
1 918889636
1 825608749
1 964031791
1 831220651
1 499513921
1 435560704
1 6944341
1 570999115
1 40394557
1 71952217
1 507182569
1 268490293
1 219086788
1 606472792
1 272282995
1 413199004
1 497217154
1 819078463
1 240473500
1 974416300
1 896597572
1 711423151
1 15691615
1 499297...

output:

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

result:

ok 17 numbers

Test #33:

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

input:

11
85 4
-1 89407561
-1 972136945
-1 232631517
-1 498398109
-1 999835213
-1 493227137
-1 215430901
-1 7203417
-1 300990093
-1 830621301
-1 867586601
-1 472003745
-1 985022497
-1 775207853
-1 160102281
-1 463701321
-1 2559949
-1 789633829
-1 338553493
-1 485660345
-1 731693905
-1 983530761
-1 48841910...

output:

1
1
1
3
2
2
1
1
1
2
1

result:

ok 11 numbers

Test #34:

score: 0
Accepted
time: 200ms
memory: 3708kb

input:

15
13 3
-1 569948511
-1 616925295
-1 38172939
-1 319891161
-1 483930618
-1 288530049
-1 511165380
-1 578868096
-1 351800007
-1 452461857
-1 718976307
-1 347863512
-1 462425067
1641 3
1 448499000
1 388048259
1 518960654
1 845653469
1 135697043
1 501417233
1 641847155
1 990061301
1 117762347
1 7925724...

output:

1
2
1
1
3
1
1
2
3
2
2
1
1
3
1

result:

ok 15 numbers

Test #35:

score: 0
Accepted
time: 409ms
memory: 6472kb

input:

7
9 12579062
1 982466066
1 781201074
1 454145462
1 995045128
1 227722346
1 152247974
1 164827036
-1 579936083
1 114510788
343 301483826
1 889088643
1 177586409
1 188316884
-1 512074022
1 715795327
1 623650283
-1 45358407
1 124167180
1 791284536
1 447388066
-1 834375288
1 447388066
1 996400434
1 7845...

output:

1
1
1
1
1
2
1

result:

ok 7 numbers

Test #36:

score: -100
Wrong Answer
time: 77ms
memory: 4184kb

input:

11
75 53408130
-1 244641683
1 282007309
1 495639829
-1 778722983
-1 138019460
-1 404866073
1 976312999
1 976312999
-1 618692630
-1 191427590
-1 31009163
-1 84611330
-1 778917020
1 869496739
-1 191427590
1 976312999
-1 832131113
-1 618692630
-1 351651980
1 298049814
-1 511682333
-1 84417293
1 9763129...

output:

0
0
1
0
0
0
0
0
0
0
0

result:

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