QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#96544#1425. Divcatalyst_testAC ✓50ms19752kbC++142.6kb2023-04-14 11:25:512023-04-14 11:25:52

Judging History

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

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2023-04-14 11:25:52]
  • 评测
  • 测评结果:AC
  • 用时:50ms
  • 内存:19752kb
  • [2023-04-14 11:25:51]
  • 提交

answer

#include <bits/stdc++.h>

using namespace std;

using i64=long long;
using u64=unsigned long long;
using db=double;
using pii=pair<int,int>;
using vi=vector<int>;

template<typename T>
inline T read(){
    T x=0,f=0;char ch=getchar();
    while(!isdigit(ch)) f|=(ch=='-'),ch=getchar();
    while(isdigit(ch)) x=x*10+(ch-'0'),ch=getchar();
    return f?-x:x;
}

#define rdi read<int>
#define rdi64 read<i64>
#define fi first
#define se second
#define pb push_back

const int N=1e5+10,L=21;

int n,m;

int pos[N*L*2],v[N*L*2],tot;
int _cnt[N*4],*cnt=_cnt+N*2;
pii val[N*2];int tot1;

void modify(int x,int to){
    --cnt[v[x]],++cnt[v[x]=to];
}

// Precondition: p > 1, m > 1
bool check(int p){
    static pii st[N*2];int tp=0;
    queue<int> q;
    for(int i=tot1-1;i>=0;i--){
        if(abs(val[i].se)>=p) q.push(val[i].fi);
        else break;
    }
    while(!q.empty()){
        int x=q.front();q.pop();
        if(abs(v[x])<p) continue;
        int nx=(x+1)%tot;
        st[++tp]={x,v[x]},st[++tp]={nx,v[nx]};
        modify(nx,v[nx]+v[x]/p),modify(x,v[x]%p);
        if(abs(v[nx])>=p) q.push(nx);
    }
    bool ret=(cnt[-p+1]==m||cnt[0]==tot||cnt[p-1]==m);
    while(tp){
        int x=st[tp].fi,y=st[tp].se;
        --cnt[v[x]],++cnt[v[x]=y],--tp;
    }
    return ret;
}

void clear(){
    for(int i=0;i<tot;i++)
        cnt[v[i]]=0,v[i]=0;
    tot=0;
}

void solve(){
    n=rdi(),m=rdi();
    i64 sum1=0;
    for(int i=0;i<n;i++){
        int b=rdi(),a=rdi();
        sum1+=b,val[i*2]={(a+1)%m,b},val[i*2+1]={a%m,-b};
    }
    if(m==1) {puts("-1");return;}
    n*=2;int len=__lg(n);
    sort(val,val+n),tot=0;
    for(int i=0,p=0;i<m;){
        while(p<n&&val[p].fi<=i) ++p;
        if((m+i-val[(p+n-1)%n].fi)%m<=len)
            pos[tot++]=i++;
        else if(p<n) i=val[p].fi;
        else break;
    }
    tot1=0;
    for(int l=0,r,j=0;l<n;l=r){
        while(pos[j]<val[l].fi) ++j;
        r=l;int sum=0;
        while(r<n&&val[l].fi==val[r].fi)
            sum+=val[r++].se;
        val[tot1++]={j,v[j]=sum};
    }
    for(int i=0;i<tot;i++)
        ++cnt[v[i]];
    sort(val,val+tot1,[&](pii a,pii b){
        return abs(a.se)<abs(b.se);
    });
    int ans=0;
    if(cnt[0]==tot) ans=-1;
    else{
        if(sum1%m==0) ++ans;
        for(int i=2;i<=n+1;i++)
            ans+=check(i);
    }
    cout<<ans<<'\n';
    clear();
}

int main(){
#ifdef LOCAL
    freopen("1.in","r",stdin);
    freopen("1.out","w",stdout);
#endif
    int T=rdi();
    while(T--) solve();
    return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 2ms
memory: 3436kb

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

input:

1
1 1
1 0

output:

-1

result:

ok 1 number(s): "-1"

Test #3:

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

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: 22ms
memory: 3444kb

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: 18ms
memory: 3400kb

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: 37ms
memory: 3404kb

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: 32ms
memory: 3428kb

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: 25ms
memory: 3500kb

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

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: 38ms
memory: 4640kb

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: 50ms
memory: 19684kb

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: 50ms
memory: 19752kb

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: 14ms
memory: 3400kb

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

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

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: 19ms
memory: 3668kb

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: 19ms
memory: 4224kb

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: 16ms
memory: 5504kb

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: 24ms
memory: 5056kb

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: 16ms
memory: 4740kb

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: 20ms
memory: 4496kb

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: 16ms
memory: 4416kb

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

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: 15ms
memory: 4032kb

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: 24ms
memory: 4712kb

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: 24ms
memory: 4368kb

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: 19ms
memory: 4256kb

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: 18ms
memory: 4820kb

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: 24ms
memory: 4828kb

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: 8ms
memory: 4792kb

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: 18ms
memory: 4136kb

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: 13ms
memory: 4332kb

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: 14ms
memory: 5268kb

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: 16ms
memory: 4312kb

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: 38ms
memory: 8844kb

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: 0
Accepted
time: 29ms
memory: 4352kb

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:

1
1
2
1
1
1
1
1
1
1
1

result:

ok 11 numbers

Test #37:

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

input:

11
62 559175515
-1 467758308
-1 467758308
-1 467758308
-1 467758308
-1 467758308
-1 467758308
-1 467758308
-1 467758308
-1 467758308
-1 467758308
-1 467758308
-1 467758308
-1 467758308
-1 467758308
-1 467758308
-1 467758308
-1 467758308
-1 467758308
-1 467758308
-1 467758308
-1 467758308
-1 46775830...

output:

1
2
1
1
1
1
1
1
1
1
1

result:

ok 11 numbers

Test #38:

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

input:

7
8 420860247
-1 426119051
1 620810159
-1 426119051
1 199949912
1 5258805
-1 620810160
-1 5258804
1 620810159
64 378691911
-1 868009474
-1 110625652
-1 110625652
-1 489317563
-1 489317563
-1 489317563
-1 110625652
-1 489317563
-1 489317563
-1 110625652
-1 110625652
-1 489317563
-1 868009474
-1 48931...

output:

2
1
1
1
1
1
1

result:

ok 7 numbers

Test #39:

score: 0
Accepted
time: 19ms
memory: 5056kb

input:

8
103 935633784
-1 131611798
-1 131611798
-1 131611798
-1 131611798
-1 131611798
-1 131611798
-1 131611798
-1 131611798
-1 131611798
-1 131611798
-1 131611798
-1 131611798
-1 131611798
-1 131611798
-1 131611798
-1 131611798
-1 131611798
-1 131611798
-1 131611798
-1 131611798
-1 131611798
-1 13161179...

output:

1
1
1
1
1
1
1
1

result:

ok 8 numbers

Test #40:

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

input:

11
8757 5
-1 492772152
1 43733994
-1 455879481
-1 393565399
1 975556496
-1 747590860
1 779115873
-1 191502103
-1 202945084
1 23757959
1 998445035
-1 790110045
1 18735733
-1 145678683
-1 926925816
-1 252529190
-1 39337682
1 754897755
1 928691372
-1 518924735
-1 930987349
-1 132247447
1 863277092
1 72...

output:

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

result:

ok 11 numbers

Test #41:

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

input:

15
30525 8
-1 880928036
-1 28168646
1 123273817
-1 101850896
1 883484410
-1 138262643
-1 334903162
-1 21264875
1 727549134
1 414355822
-1 986300582
-1 730695939
1 604567065
1 853540024
1 664809943
-1 211552987
1 484532610
-1 872252334
-1 883390329
-1 591457136
1 360867476
-1 37514974
1 674919990
-1 ...

output:

1
1
1
1
1
-1
1
1
1
2
1
1
1
1
1

result:

ok 15 numbers

Test #42:

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

input:

5
90450 537000861
1 723389178
1 557952582
1 457832813
-1 101016753
-1 399833044
-1 24812519
-1 279158932
-1 561813380
-1 772341115
1 488295762
-1 469199870
-1 532510180
-1 344063124
-1 30672918
-1 500704958
1 110056478
1 23700468
-1 660724618
1 330220610
1 998540482
-1 689642287
-1 593273837
-1 1029...

output:

1
1
1
1
1

result:

ok 5 number(s): "1 1 1 1 1"

Test #43:

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

input:

6
87883 8
1 205367722
1 530597706
-1 692834146
1 966568816
1 836809374
1 677300866
-1 417667280
1 737887027
1 618783899
-1 509813171
1 180251731
-1 38770626
1 799519848
-1 660764474
1 107221338
1 355201308
-1 936894354
-1 161825563
-1 803175459
-1 171175898
1 264982728
1 447264680
-1 756077370
-1 22...

output:

1
2
1
1
1
1

result:

ok 6 numbers

Test #44:

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

input:

8
4 195374
1 220153045
-1 603867582
1 975273555
1 863324253
777 31
-1 255457844
-1 975740860
-1 884637786
1 500028114
-1 203939657
-1 217935356
-1 355696127
-1 383766880
-1 27159868
1 713653795
1 326694714
1 432453911
-1 953482214
1 933460845
1 49561162
-1 650716126
1 4596251
-1 623295138
-1 4449006...

output:

1
1
1
1
1
1
2
2

result:

ok 8 numbers

Test #45:

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

input:

10
1243 37548839
-1 909344457
-1 850058468
1 55755909
1 757895734
1 409344484
-1 916074965
1 910934066
1 695293923
-1 969489992
-1 22645271
-1 635863186
1 790345945
1 658691954
1 138816240
1 460347998
1 764719871
1 70591602
-1 111856191
1 314680388
-1 895517589
-1 787639902
-1 529853766
1 957606518
...

output:

1
1
1
1
1
1
1
1
1
1

result:

ok 10 numbers

Test #46:

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

input:

6
1606 812
1 376450518
-1 813555660
1 288725725
1 119263569
-1 530624790
1 110704932
1 701981988
-1 134212396
1 15407809
1 299926113
-1 437116701
-1 973558465
-1 86473770
-1 436073874
-1 515119636
-1 23314804
-1 536418410
1 645118857
-1 864071252
1 72894125
1 881836667
-1 435504574
1 821558729
1 772...

output:

1
1
1
2
2
-1

result:

ok 6 numbers

Test #47:

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

input:

9
24 3986
-1 458470440
1 884124531
1 614567609
1 278735151
-1 610804510
1 865689595
-1 76154305
-1 895747706
-1 311180876
-1 188558450
-1 38104002
1 593517543
-1 593162421
-1 419289115
-1 316541993
1 735988774
-1 747208308
-1 953201857
-1 739431622
1 794852967
1 615305019
-1 49807214
-1 549371170
-1...

output:

1
1
-1
1
1
1
1
1
1

result:

ok 9 numbers

Test #48:

score: 0
Accepted
time: 26ms
memory: 4128kb

input:

7
39063 2
-1 968127174
1 706226490
-1 500665580
1 137115919
1 291391461
1 169611039
1 686108929
-1 813997286
-1 672660367
1 653044882
1 625016083
-1 249933402
1 185444838
-1 187721346
1 541907184
1 509935442
1 640608720
1 44965483
1 571013948
1 156118763
1 88589880
-1 194276571
-1 465834160
1 652898...

output:

3
2
1
2
1
2
1

result:

ok 7 numbers

Test #49:

score: 0
Accepted
time: 22ms
memory: 4548kb

input:

11
18532 101289086
1 517151757
1 213284499
1 213284499
1 618440843
1 10706327
1 314573585
1 922308101
1 922308101
1 922308101
1 314573585
1 618440843
1 111995413
1 111995413
1 111995413
1 517151757
1 517151757
1 314573585
1 415862671
1 314573585
1 821019015
1 111995413
1 922308101
1 719729929
1 6184...

output:

1
1
1
1
1
1
1
1
1
1
1

result:

ok 11 numbers

Test #50:

score: 0
Accepted
time: 37ms
memory: 5340kb

input:

14
7326 2
-1 25325788
-1 200085308
1 330515980
-1 68902704
1 788069154
-1 977687299
-1 662438732
-1 784651934
1 325211568
-1 972155589
1 321635785
1 989497440
1 242472143
-1 996619012
-1 18948692
1 454508778
1 874358690
-1 199541117
1 698327807
-1 74885008
1 381624124
-1 763226757
1 398979089
1 6899...

output:

11
1
1
1
1
1
1
1
2
1
1
1
1
1

result:

ok 14 numbers

Test #51:

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

input:

10
1620 3866806
-1 538274481
-1 982607945
1 62119772
-1 470512145
-1 37429873
1 931079427
1 529376629
1 611206224
-1 494516121
1 525554988
1 833853485
-1 713108860
-1 527053398
1 133961599
-1 438565634
1 495202044
-1 70041729
-1 808508943
-1 206557274
1 7402984
1 77586996
-1 646545049
-1 293442209
-...

output:

1
1
1
1
1
1
2
1
-1
1

result:

ok 10 numbers

Test #52:

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

input:

11
236 322
1 471319163
-1 811446242
1 922358409
1 92313752
1 538732117
-1 375863962
1 282531710
1 224400225
1 256841403
1 550571091
-1 632037502
-1 888528212
1 243079626
-1 690771268
1 805234908
1 512172128
1 631026192
1 125173027
1 906875818
1 448751471
-1 134051944
1 837248148
-1 315465134
-1 7515...

output:

1
2
1
1
-1
-1
1
1
2
1
-1

result:

ok 11 numbers

Test #53:

score: 0
Accepted
time: 16ms
memory: 4580kb

input:

9
1099 30
-1 396609728
-1 10415060
-1 658568588
-1 705604028
1 468434842
-1 265089878
-1 764103900
1 877252852
1 884351692
1 432802204
-1 858550058
-1 326913608
1 389954992
1 87610984
-1 939603140
-1 152033228
-1 38620490
-1 515694608
-1 802600740
-1 561373525
-1 501166718
1 135935212
-1 625427490
-...

output:

1
1
1
1
1
1
1
1
1

result:

ok 9 numbers

Test #54:

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

input:

10
5 1154283
1 778012706
-1 801098367
1 470973428
1 515990465
1 771087008
4 58925271
1 706258299
-1 175930861
1 706258299
1 117005589
2120 3384569
-1 4883742
-1 837487716
-1 543030213
-1 935640217
-1 681797542
-1 96267105
-1 786719181
-1 915332803
-1 922101941
-1 153804778
-1 400878315
-1 810411164
...

output:

1
1
1
-1
1
2
1
1
1
1

result:

ok 10 numbers

Test #55:

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

input:

17
5 861
1 691863697
-1 845644323
-1 425573616
-1 974752134
-1 927678681
36 57650445
1 360199053
-1 784472148
-1 174954028
-1 842122593
-1 748437786
-1 904425745
-1 751458478
-1 232604473
1 405555809
1 706101723
1 611520814
1 904425746
-1 207967698
-1 117303583
-1 789124855
-1 327921295
1 706101723
...

output:

1
1
1
1
1
1
1
1
2
1
1
1
-1
1
3
1
1

result:

ok 17 numbers

Test #56:

score: 0
Accepted
time: 34ms
memory: 4688kb

input:

10
30921 15273144
1 525631452
1 744674583
-1 788500289
1 342292185
-1 497879586
-1 261342548
-1 142279940
1 859521949
1 447522531
1 402662744
-1 834929083
1 815821188
-1 580647416
1 192117587
-1 566389590
-1 546502978
-1 913337601
1 441408482
1 273602840
-1 226034493
-1 228331999
1 114372779
-1 2958...

output:

1
1
1
3
1
1
1
-1
1
1

result:

ok 10 numbers

Test #57:

score: 0
Accepted
time: 26ms
memory: 5048kb

input:

6
224 134053
1 966795451
1 630969104
1 547841102
1 355915930
1 502659366
1 658697058
1 733230526
1 371466078
1 838617201
1 472765547
1 208949243
1 920389531
1 497163193
1 596115324
1 454540214
1 644106298
1 351468599
1 178122928
1 79454045
1 977341039
1 663567565
1 396897424
1 137370816
1 510970652
...

output:

1
1
5
1
1
-1

result:

ok 6 numbers

Test #58:

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

input:

10
12 2504
1 869150743
1 40484688
1 446132688
1 83771143
1 838965216
1 945848263
-1 953375288
1 772216088
1 255848720
-1 803483537
1 614246047
1 253847831
186 30162243
-1 696444794
1 621845778
-1 123362177
1 259898862
-1 817093766
-1 183686663
-1 2713205
-1 455146850
1 380547834
1 229736619
-1 12336...

output:

1
2
1
1
1
1
1
1
2
1

result:

ok 10 numbers

Test #59:

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

input:

9
97208 11790
1 50167246
1 764205016
1 720841396
1 40794196
1 960708946
1 16660066
1 688819756
1 744987316
1 504895756
1 314616946
1 272703496
1 667739236
1 54505966
1 93566236
1 251422546
1 120871876
1 492056446
1 783410926
1 166263376
1 502537756
1 163162606
1 854304196
1 937647706
1 117146236
1 3...

output:

1
-1
1
1
1
1
1
1
-1

result:

ok 9 numbers

Test #60:

score: 0
Accepted
time: 20ms
memory: 5660kb

input:

1
100000 50000
-1 112903390
1 740399999
1 439649999
-1 488093903
-1 716972257
-1 48220403
-1 268871563
-1 827134575
1 193099999
1 71199999
1 110049999
1 105599999
-1 409662563
1 106399999
1 517299999
-1 274359219
-1 790766168
1 726799999
-1 849441046
1 979949999
-1 936248533
1 656399999
1 116999999
...

output:

1

result:

ok 1 number(s): "1"

Test #61:

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

input:

1
100000 50000
-1 743699999
1 692693406
-1 687099999
1 115584456
-1 995249999
-1 679349999
1 487844097
1 791445055
1 477613045
1 124786690
-1 965849999
-1 781149999
-1 174399999
1 642504392
-1 18099999
1 448078957
1 741885483
-1 503699999
-1 854149999
-1 622899999
-1 62749999
1 802965976
1 965404491...

output:

1

result:

ok 1 number(s): "1"

Test #62:

score: 0
Accepted
time: 26ms
memory: 5460kb

input:

15
1120 8433453
1 266487521
-1 74969999
1 815115914
1 203162933
-1 430117923
1 596961272
1 407718418
1 935637877
-1 588295231
-1 418289673
1 564255131
1 889967158
-1 141554809
1 795266972
-1 393443266
-1 300221331
1 582926452
1 731896520
1 302360495
-1 185637842
-1 706363574
-1 942500257
1 468049116...

output:

1
1
1
1
1
1
1
1
1
1
1
1
1
1
1

result:

ok 15 numbers

Test #63:

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

input:

9
24892 996647113
-1 307697406
-1 58803185
-1 601211887
-1 204899403
-1 494638963
1 55599320
-1 340369370
-1 705998460
1 826764537
1 978478535
1 113394998
1 538091217
-1 845263510
1 881499363
-1 937095775
-1 248435947
-1 23227599
1 628120537
-1 307697405
1 302490464
1 845263510
1 786250599
1 5380912...

output:

1
1
1
1
1
1
1
1
1

result:

ok 9 numbers

Test #64:

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

input:

10
19 192485751
1 663364393
1 663364393
1 470878642
1 470878642
1 85907140
1 85907140
1 85907140
1 85907140
1 470878642
1 278392891
1 85907140
1 85907140
1 470878642
1 663364393
1 470878642
1 663364393
1 470878642
-1 470878643
1 278392891
690 855835862
1 18403743
1 18403743
1 874239605
1 874239605
1...

output:

1
1
1
1
1
1
1
1
1
1

result:

ok 10 numbers

Test #65:

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

input:

11
4 925475573
1 343878257
-1 343878258
1 343878257
1 343878257
11956 409123701
-1 747353619
-1 747353619
1 382345652
1 382345652
1 942805207
-1 747353619
1 382345652
1 382345651
1 942805207
1 124557805
1 791469352
1 382345652
-1 338229918
1 533681506
1 533681506
1 791469352
1 791469353
-1 747353619...

output:

1
1
1
1
1
1
1
1
1
1
1

result:

ok 11 numbers

Test #66:

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

input:

7
4 494322175
-1 119646419
1 613968593
1 119646418
1 613968593
32340 511174733
-1 578654643
-1 67479910
-1 578654643
-1 578654643
-1 578654643
-1 578654643
-1 578654643
-1 67479910
-1 67479910
-1 67479910
-1 578654643
-1 578654643
-1 67479910
-1 578654643
-1 67479910
-1 67479910
-1 67479910
-1 57865...

output:

1
1
1
2
1
1
1

result:

ok 7 numbers

Test #67:

score: 0
Accepted
time: 34ms
memory: 4380kb

input:

10
3 19767427
1 559980719
-1 421608731
1 698352708
5 630
-1 159212500
1 756617561
-1 285549550
-1 272863870
-1 23963470
30 331616
-1 858403687
-1 64514983
1 16934455
1 275263320
-1 465610902
1 592447656
1 237839012
1 578077028
-1 106519077
1 350920068
-1 390334071
-1 266972919
1 531319172
-1 7653917...

output:

1
1
1
1
1
1
1
1
1
1

result:

ok 10 numbers

Test #68:

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

input:

9
873 38625
1 948696052
-1 585904871
-1 934095803
-1 21773302
1 812910223
-1 551109860
1 262310848
-1 935847371
1 630136723
-1 959386747
1 467023348
1 732125677
-1 402558110
-1 392090735
-1 251881985
-1 83399735
-1 165323360
-1 372276110
-1 158254985
-1 222855051
-1 65394371
1 682569802
-1 98502110
...

output:

1
1
1
1
1
1
1
1
1

result:

ok 9 numbers

Test #69:

score: 0
Accepted
time: 24ms
memory: 4660kb

input:

7
104 3185
1 916777520
1 556273740
1 846143775
1 31841196
1 925243250
1 209115111
1 812780900
1 73437295
1 636274571
1 653311135
1 194540550
1 511728330
1 28675305
1 545826940
1 463908740
1 945824720
1 563287110
1 55384716
1 812898746
1 788262770
1 315799870
1 628210151
1 8635286
1 754049500
1 24357...

output:

1
1
1
-1
2
1
1

result:

ok 7 numbers

Test #70:

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

input:

9
8309 381022377
1 711312510
1 330290133
1 330290133
1 711312510
1 330290133
1 711312510
1 330290133
1 330290133
1 711312510
1 711312510
1 711312510
1 330290133
1 711312510
1 330290133
1 330290133
1 330290133
1 330290133
1 711312510
1 330290133
1 330290133
1 711312510
1 330290133
1 711312510
1 33029...

output:

1
1
1
2
1
1
1
1
1

result:

ok 9 numbers

Test #71:

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

input:

6
1546 113
-1 373267781
-1 120291404
-1 920299312
-1 156508582
-1 393088659
-1 614399611
-1 531481793
-1 374778478
-1 791957528
-1 561448150
-1 568425674
-1 536641147
-1 238366460
-1 41672558
-1 27278053
-1 552143278
-1 296174774
-1 408687518
-1 542852305
-1 54218496
-1 958750726
-1 803121137
-1 863...

output:

1
1
1
1
-1
1

result:

ok 6 numbers

Test #72:

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

input:

16
9972 306147893
1 39103650
-1 870249693
1 308906330
1 154470253
-1 278994103
1 184225776
-1 324168845
1 154976742
-1 381578165
1 814439087
-1 96630190
1 978365091
-1 281439061
-1 834553708
1 804146553
-1 569585103
1 595509216
1 929762189
-1 308906328
1 48961751
1 292310283
1 422857609
-1 387452740...

output:

1
1
1
1
1
1
1
-1
1
2
1
1
1
1
1
2

result:

ok 16 numbers

Test #73:

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

input:

11
51 1371288
-1 364960023
1 548712614
1 684470126
1 525400718
1 48192494
1 253885694
1 362217446
1 281311454
1 724237478
1 447237302
1 156524246
1 902504918
1 617277014
1 584366102
1 321078806
1 655673078
1 615905726
1 668014670
1 37222190
1 876450446
1 508945262
1 622762166
1 803772182
1 918960374...

output:

1
1
1
1
1
1
1
1
1
1
1

result:

ok 11 numbers

Test #74:

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

input:

13
2922 183972321
-1 760241630
-1 208324667
-1 760241630
-1 944213951
-1 208324667
-1 5341163
-1 392296988
-1 576269309
-1 24352346
-1 576269309
-1 760241630
-1 5341163
-1 24352346
-1 24352346
-1 189313484
-1 557258126
-1 208324667
-1 925202768
-1 208324667
-1 392296988
-1 24352346
-1 944213951
-1 9...

output:

1
-1
-1
1
1
1
1
1
1
-1
3
1
1

result:

ok 13 numbers

Test #75:

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

input:

9
19768 200110
1 99179318
1 425958948
1 621066198
1 335309118
1 551828138
1 980663868
1 848791378
1 87773048
1 426359168
1 374330568
1 30341478
1 895817228
1 888012938
1 783355408
1 150207368
1 882009638
1 495197008
1 52553688
1 103581738
1 822576968
1 282880298
1 45549838
1 723122298
1 928835378
1 ...

output:

1
1
1
1
1
-1
1
1
1

result:

ok 9 numbers

Test #76:

score: 0
Accepted
time: 16ms
memory: 4944kb

input:

8
504 197680604
-1 824450611
-1 582297765
1 506645351
-1 730929554
1 506645351
-1 977658974
-1 779978370
-1 977658974
-1 626770007
-1 779978370
-1 806991334
-1 231408799
1 928610159
1 902006559
1 308964747
1 137887743
-1 977658974
-1 609310730
-1 582297765
-1 824450611
-1 626770007
-1 824450611
-1 3...

output:

1
1
1
1
1
1
1
1

result:

ok 8 numbers

Test #77:

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

input:

13
50 1
1 466379264
1 459608570
1 35204187
1 664630566
-1 46825975
1 503622389
-1 926131394
1 967637121
1 481863355
1 472712172
-1 523648094
1 574897680
1 442677380
1 714958893
1 981010407
1 166425523
1 692924895
1 998380498
-1 775761866
-1 539915741
-1 94840971
-1 315053436
1 521722787
1 421112364
...

output:

-1
1
-1
1
1
2
1
1
1
1
1
1
1

result:

ok 13 numbers

Test #78:

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

input:

10
816 67246232
-1 492772628
-1 414680299
1 4360821
-1 750911459
-1 347434067
-1 212941603
1 71607053
-1 161158278
-1 900866830
-1 855423017
-1 564635670
1 414680298
-1 89295236
-1 845405409
-1 845405409
-1 979897873
-1 451945625
1 11202906
1 11202906
-1 609576909
1 273345749
1 811315605
-1 56001886...

output:

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

result:

ok 10 numbers

Test #79:

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

input:

5
522 3813035
1 106808948
1 297460698
1 648259918
1 3857003
1 751211863
1 816033458
1 57239493
1 652072953
1 396599608
1 613942603
1 549121008
1 533868868
1 884668088
1 758837933
1 221199998
1 442356028
1 225013033
1 789342213
1 594877428
1 465234238
1 465234238
1 983806998
1 659699023
1 122061088
1...

output:

1
1
7
1
1

result:

ok 5 number(s): "1 1 7 1 1"

Test #80:

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

input:

9
144 138591346
1 170560967
1 724926351
-1 309152313
-1 31969621
-1 586335005
-1 863517697
-1 863517697
1 863517697
1 586335005
-1 31969621
-1 309152313
1 170560967
-1 31969621
-1 170560967
-1 31969621
-1 170560967
1 447743659
-1 724926351
1 170560967
1 309152313
-1 863517697
-1 309152313
1 58633500...

output:

-1
1
1
1
1
2
1
1
1

result:

ok 9 numbers

Test #81:

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

input:

7
74090 325103446
1 581429150
1 256325704
1 906532596
1 906532596
1 581429150
1 906532596
1 906532596
1 906532596
1 906532596
1 581429150
1 906532596
1 581429150
1 906532596
1 581429150
1 906532596
1 256325704
1 906532596
1 906532596
1 581429150
1 581429150
1 906532596
1 256325704
1 256325704
1 9065...

output:

1
1
-1
1
1
-1
1

result:

ok 7 numbers

Test #82:

score: 0
Accepted
time: 23ms
memory: 4364kb

input:

12
590 787676695
-1 754740077
-1 36471664
1 780405686
-1 172587368
1 560328626
-1 599821175
1 599821175
1 377712536
1 377712535
-1 377712535
1 560328626
1 934204632
1 599821176
-1 934204630
1 29445046
-1 524678392
-1 754740076
1 502061525
1 377712536
-1 146527937
1 107256656
-1 754740076
-1 21785392...

output:

1
1
2
1
2
1
1
1
1
1
1
1

result:

ok 12 numbers

Test #83:

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

input:

13
2024 413
-1 877883096
1 784708291
1 102540212
1 562624339
1 536930946
1 568288731
1 372757665
1 68077076
1 582904041
-1 341590261
1 182174205
-1 168025410
1 672532889
-1 177780965
-1 147858514
-1 756490938
-1 328965048
-1 638020731
1 257467703
1 409405471
-1 438347621
1 226373119
1 713622670
1 36...

output:

1
1
1
1
1
1
1
2
-1
1
1
1
1

result:

ok 13 numbers

Test #84:

score: 0
Accepted
time: 26ms
memory: 4872kb

input:

9
775 258147
-1 202152974
1 825427495
1 41951351
-1 344391972
-1 752264232
-1 558395835
1 652210858
1 574508612
1 908034536
1 567796790
1 809164234
-1 761557523
1 210263195
1 926621119
1 710702565
1 986145414
1 741680205
1 435367379
-1 407379840
1 209488753
1 139014623
1 249501538
-1 197764476
1 590...

output:

1
1
1
1
1
1
1
1
1

result:

ok 9 numbers

Test #85:

score: 0
Accepted
time: 24ms
memory: 4156kb

input:

12
3121 916678127
1 324284768
1 324284768
1 324284768
1 324284768
1 324284768
1 324284768
1 324284768
1 324284768
1 324284768
1 324284768
1 324284768
1 324284768
1 324284768
1 324284768
1 324284768
1 324284768
1 324284768
1 324284768
1 324284768
1 324284768
1 324284768
1 324284768
1 324284768
1 3242...

output:

1
1
1
1
1
1
1
1
1
2
1
1

result:

ok 12 numbers

Test #86:

score: 0
Accepted
time: 16ms
memory: 4924kb

input:

8
28 726532870
-1 904906064
1 904906065
-1 904906064
-1 904906064
-1 178373194
-1 904906064
-1 178373194
-1 178373194
-1 178373194
-1 904906064
-1 904906064
-1 178373194
-1 904906064
-1 904906064
-1 904906064
-1 904906064
-1 904906064
-1 178373194
-1 904906064
-1 904906064
-1 178373194
-1 178373194
...

output:

1
1
-1
1
1
1
1
1

result:

ok 8 numbers