QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#487846#8510. Fair Distributionprime-idealAC ✓8ms3708kbC++201.8kb2024-07-23 11:37:572024-07-23 11:38:01

Judging History

This is the latest submission verdict.

  • [2024-07-23 11:38:01]
  • Judged
  • Verdict: AC
  • Time: 8ms
  • Memory: 3708kb
  • [2024-07-23 11:37:57]
  • Submitted

answer

#include <bits/stdc++.h>
using namespace std;
#define RN return
#define forw(_,l,r) for(auto _=(l);_<(r);++_)
#define fors(_,r,l) for(auto _=(r);_>(l);--_)
// #define DEBUG if((cout<<"line:"<<__LINE__<<'\n'), 1)
#define DEBUG if(0)
// #define int ll
#define fastio cin.tie(0);cout.tie(0);ios::sync_with_stdio(false);
#define DEBUG if(0)

void read(){}
template<typename T,typename...Types>
void read(T& x, Types&...args){
  x=0; char c=' '; bool sgn=0;
  while(isspace(c))c=getchar();
  if(c=='-')c=getchar(),sgn=1;
  while(isdigit(c))x=10*x+c-'0',c=getchar();
  if(sgn)x=-x;
  read(args...);
}
void write(auto x){
  char str[100],p=0;
  do{str[p++]=x%10+'0',x/=10;}while(x);
  fors(i,p-1,-1)putchar(str[i]);
}

typedef unsigned long long ull;
typedef long long ll;
const int NUM=1e5+10;
ull dp_[NUM/64+10]={},*dpv=dp_+2;//!
void dp(int x, int t){
  int d1=x/64,d2=x%64;
  fors(i,t/64+2,d1-1){
    dpv[i]|=(dpv[i-d1]<<d2);
    if(d2)dpv[i]|=(dpv[i-d1-1]>>(64-d2));
  }
}
bool getbit(int x){
  RN (dpv[x/64]&(1ull<<(x%64)));//!
}
map<int,int> mp;
vector<int> gs;

int main()
{
  int N,R=0,S=0; read(N);
  dpv[0]=1; bool hasz=0;
  forw(i,0,N){
    int g,r;read(g,r);
    mp[g]++,R=__gcd(R,r);S+=g;
    hasz|=g==0;
  }
  if(S&1){
    if((R&1)==0){puts("N");RN 0;}//!
    else if(R>S){puts("N");RN 0;}
  }
  int target=(S&1)?(S-R)/2:S/2;
  for(auto [s,c]:mp){
    for(int r,t;;c-=t){
      t=(c+1)/2,r=s*t;
      if(r<=target)
        gs.push_back(s*((c+1)/2));
      if(c==1)break;
    }
  }for(auto x: gs){
    dp(x,target);
    // cout<<x<<' '<<getbit(62)<<endl;
  }target%=R;
  for(;target<=S/2;target+=R){
    bool ok=getbit(target);
    if(target==0&&!hasz)continue;
    if(ok){puts("Y");RN 0;}
  }puts("N");
  RN 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

3
1 1
0 3
2 1

output:

Y

result:

ok "Y"

Test #2:

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

input:

3
3 2
2 1
3 2

output:

Y

result:

ok "Y"

Test #3:

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

input:

3
1 10
2 20
4 30

output:

N

result:

ok "N"

Test #4:

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

input:

1
1 1

output:

N

result:

ok "N"

Test #5:

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

input:

10
5 8556
4 6246
4 7032
7 4551
7 3375
7 3150
4 7230
4 1389
6 5580
5 5676

output:

Y

result:

ok "Y"

Test #6:

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

input:

10
6 6436
6 2492
7 2152
3 9412
3 4432
5 92
7 274
3 5842
3 8268
6 2826

output:

N

result:

ok "N"

Test #7:

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

input:

10
7 959992506
10 731828250
93 596052186
62 279294222
69 489999399
84 568064880
98 764969712
21 213445155
57 722664582
42 247354419

output:

N

result:

ok "N"

Test #8:

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

input:

11
31 386357400
51 243681768
47 27696240
40 46130832
31 103051872
61 977440860
82 305806248
13 411895044
12 344125584
28 305898120
0 250018164

output:

Y

result:

ok "Y"

Test #9:

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

input:

10
39 693942466
22 436140057
62 825351960
30 86746148
58 577679211
61 600762282
95 379086147
80 355793419
61 1152290
100 301091791

output:

N

result:

ok "N"

Test #10:

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

input:

11
63 261663296
67 846390296
20 338653664
100 840431600
15 977897920
38 630729496
82 949097248
68 43850520
20 955085808
78 782591440
0 797531872

output:

N

result:

ok "N"

Test #11:

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

input:

10
93 116229272
29 52768904
54 787247432
51 171508736
62 661977872
55 904062880
42 226216224
62 702462640
63 913252552
57 68361640

output:

Y

result:

ok "Y"

Test #12:

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

input:

11
17 859745096
77 375531513
7 450186737
33 678098519
20 91695737
27 131142389
17 688089913
46 63379764
22 34106009
35 939981161
0 575280531

output:

Y

result:

ok "Y"

Test #13:

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

input:

10
84 145373942
76 52044013
44 341204535
84 701613479
26 606804702
44 814210005
87 833951482
36 901024509
43 159977503
39 668944598

output:

Y

result:

ok "Y"

Test #14:

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

input:

11
8 884332071
24 758017141
89 784299250
61 739743907
88 969241987
17 489388704
70 680715028
24 430113089
3 965144327
21 949787748
0 278428780

output:

Y

result:

ok "Y"

Test #15:

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

input:

23
73 684793000
89 722533000
99 218419000
33 739414000
21 461496000
66 514288000
43 686976000
68 439943000
5 765640000
4 189618000
52 831765000
87 171686000
24 996921000
20 889760000
6 223444000
57 917704000
64 703837000
88 531347000
67 80098000
6 846248000
3 375821000
23 129094000
2 6440000

output:

Y

result:

ok "Y"

Test #16:

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

input:

26
97 848857293
29 181470348
45 440629929
14 457087455
75 263883852
35 314979705
15 835764399
56 250479270
61 280815903
83 181281537
96 937354707
35 349615035
14 451275273
49 105796098
29 433684881
66 487930581
87 791438769
50 379395225
14 298269432
19 612172215
9 555890553
3 37457505
8 919948131
7 ...

output:

Y

result:

ok "Y"

Test #17:

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

input:

25
22 255697827
30 558099682
49 777417984
77 529011021
100 302373022
52 941172932
87 140287756
47 565446980
99 862144794
56 776669159
76 302365098
20 772534042
26 454035925
33 459267249
9 389853716
9 239167418
25 993338717
49 715733571
70 679143108
23 890414161
30 779479407
3 465470775
1 47558504
1 ...

output:

Y

result:

ok "Y"

Test #18:

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

input:

27
47 416640496
75 578504864
7 158575192
59 368775680
57 386670360
28 871051040
70 163365400
35 774172600
55 800174512
38 128453024
20 538524768
60 50911584
17 551134280
75 846139072
28 125139200
18 585912168
51 645163784
11 356146080
88 282713968
68 918977224
27 263870376
40 616030736
9 191742664
9...

output:

N

result:

ok "N"

Test #19:

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

input:

28
59 458833494
7 471485140
56 130308860
30 361083386
14 611314920
25 656698970
79 465203728
9 891802820
16 443213796
16 683782694
16 137276896
94 833303054
29 482692680
13 291935958
16 158426512
1 350851890
8 637917608
93 159715928
57 442078072
39 529569738
33 685697856
53 822553596
31 977529024
24...

output:

Y

result:

ok "Y"

Test #20:

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

input:

24
87 14958027
52 981631386
13 574293132
7 127005867
64 289820889
2 538839621
58 697057245
1 456501042
71 59287653
98 703021275
60 128437434
34 188624187
19 705355938
54 707916375
39 964323711
18 55963980
34 612504882
47 767963268
79 522216261
79 687865446
74 575981442
7 996142860
2 582503913
0 3854...

output:

Y

result:

ok "Y"

Test #21:

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

input:

22
67 229849473
84 925090131
31 617884561
31 872436600
72 27179950
39 845972134
75 977272093
2 849220400
82 50755243
4 927097241
32 494354553
11 436198182
60 492471476
60 735405153
30 496673933
23 778431864
83 768935048
71 456550738
11 25150706
75 435747851
52 669527607
5 354483948

output:

Y

result:

ok "Y"

Test #22:

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

input:

24
91 233737784
28 264300309
85 984875010
12 142732961
26 800435307
4 506007810
58 882071302
90 621433491
37 699587196
90 115707690
72 344495361
50 563416385
50 91364364
90 74127984
45 708040585
40 820480829
1 243428241
29 532434336
29 765967860
20 416696910
4 849802758
30 244532148
18 812376719
0 8...

output:

Y

result:

ok "Y"

Test #23:

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

input:

100192
1 579800000
2 629200000
1 610400000
1 483200000
2 154200000
2 690200000
2 373800000
2 950200000
1 995000000
1 965200000
2 529200000
1 765200000
2 63400000
2 238200000
2 230200000
2 237000000
3 697200000
1 581600000
2 402400000
2 270600000
2 918400000
1 945400000
1 540000000
1 923600000
2 8218...

output:

Y

result:

ok "Y"

Test #24:

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

input:

100131
3 407400000
3 729800000
3 926000000
1 803000000
3 789200000
3 171000000
1 958400000
3 472400000
3 519000000
1 97000000
1 212200000
3 743600000
1 513400000
3 898800000
2 120800000
3 276800000
3 828800000
3 83400000
2 317400000
3 41600000
1 43800000
1 249800000
2 595600000
2 317800000
1 4264000...

output:

Y

result:

ok "Y"

Test #25:

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

input:

99890
1 91120107
2 305041891
3 166652038
2 611800052
2 561135747
1 79291737
3 789128082
3 707155932
1 270099826
1 832261335
2 888289223
3 79971119
2 779422000
3 347495040
3 707216281
3 847347097
2 745264077
1 571873834
1 555323470
3 625335740
1 345321832
1 1557472
2 437521539
1 165519787
1 743029433...

output:

Y

result:

ok "Y"

Test #26:

score: 0
Accepted
time: 6ms
memory: 3604kb

input:

100031
3 424689246
3 44795097
2 49298616
1 837459755
1 128123922
2 368467653
1 983853301
2 642281247
3 10897446
3 132854290
2 845014534
1 116631011
2 615040059
2 153001855
2 462278030
3 868972296
3 530509334
3 866684048
3 837305750
3 476441891
1 305447459
1 224233994
1 561039114
2 990207566
1 758680...

output:

Y

result:

ok "Y"

Test #27:

score: 0
Accepted
time: 6ms
memory: 3572kb

input:

100014
3 74800000
3 160200000
2 831400000
3 849800000
1 399400000
3 290400000
1 467400000
3 35000000
3 295800000
3 921200000
2 965400000
2 814800000
3 114400000
3 261600000
2 719400000
3 46600000
1 414400000
3 87600000
2 887800000
3 750000000
3 755800000
3 227600000
3 280200000
1 873800000
1 6468000...

output:

Y

result:

ok "Y"

Test #28:

score: 0
Accepted
time: 6ms
memory: 3600kb

input:

100065
2 361600000
1 260600000
1 444600000
1 249600000
2 493600000
1 14400000
3 213600000
1 557200000
1 819800000
3 512200000
3 27400000
2 334000000
1 266800000
2 624600000
3 69400000
3 545400000
2 465800000
1 589600000
3 803000000
2 521200000
2 340400000
2 532000000
2 633400000
1 268000000
3 251200...

output:

Y

result:

ok "Y"

Test #29:

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

input:

100049
1 830873314
1 187688469
1 392311741
1 178788226
1 145278960
2 128792764
3 19220693
2 152986256
2 715916973
2 938729750
2 629981819
2 620621881
2 879896112
3 102556790
3 23808775
3 632592355
2 335041586
3 148823410
2 111462326
3 585461366
1 862965650
2 125075046
1 967242023
2 326395105
1 33367...

output:

Y

result:

ok "Y"

Test #30:

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

input:

99908
1 459409748
1 222408972
1 715149808
2 844639418
3 857491326
3 563192872
3 918978616
3 383078867
3 456714593
2 384546897
3 881674426
2 802505965
3 860738362
1 203030901
1 483903229
3 654217553
3 975062652
2 443633623
1 688411901
1 141600222
1 528123981
2 347751569
1 90759597
2 856115588
3 49455...

output:

Y

result:

ok "Y"

Test #31:

score: 0
Accepted
time: 2ms
memory: 3632kb

input:

13345
18 938600000
18 451000000
15 769800000
11 943800000
18 481600000
15 996000000
17 293200000
13 58400000
12 357400000
18 187200000
19 549800000
13 882800000
13 387000000
15 956000000
13 631400000
16 161600000
14 73600000
16 900600000
16 219400000
12 287000000
14 582400000
18 846600000
13 4948000...

output:

Y

result:

ok "Y"

Test #32:

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

input:

13321
13 684600000
17 172200000
11 544800000
13 343800000
11 955000000
15 638400000
15 498600000
14 580600000
19 719800000
13 319000000
11 612000000
16 240400000
11 539400000
11 616600000
15 981400000
15 660600000
14 125200000
15 402400000
18 296200000
13 58000000
16 707800000
14 610200000
16 980000...

output:

Y

result:

ok "Y"

Test #33:

score: 0
Accepted
time: 2ms
memory: 3596kb

input:

13346
17 491688028
11 979687128
11 361639254
15 824367110
14 88688734
13 14124522
15 760890142
17 455718268
12 257323644
11 864220496
16 186624522
12 336053578
16 56497638
16 660877500
16 758869794
12 20034326
15 589788852
11 588177160
19 844613842
17 277169712
11 306462440
11 783061306
17 642635248...

output:

N

result:

ok "N"

Test #34:

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

input:

13293
12 169347744
15 524564066
12 358433502
12 988100154
16 551524030
17 796238177
12 280202994
18 457951745
13 14683634
15 732703203
12 404813380
15 849910872
11 68899581
14 635945565
19 929463942
14 31642361
19 80139683
13 738641898
17 499256497
12 694723712
19 613356847
11 909174471
17 590059391...

output:

Y

result:

ok "Y"

Test #35:

score: 0
Accepted
time: 2ms
memory: 3612kb

input:

13326
12 54399184
12 602590961
13 990785138
12 390594141
11 726789098
14 757788633
13 7599886
17 304795428
14 496392554
16 763988540
19 365194522
19 473192902
15 140197897
14 520192197
13 579991300
13 971185432
18 629190562
13 406593901
15 866387004
12 604790928
13 40599391
15 669589956
11 532792008...

output:

N

result:

ok "N"

Test #36:

score: 0
Accepted
time: 2ms
memory: 3616kb

input:

13322
16 341184646
16 243989020
18 603972820
18 710368032
13 659170336
14 238589263
11 753766079
18 206190721
11 20399082
11 193391297
14 48197831
14 289986950
19 590373432
16 342384592
11 929758159
19 469978850
18 842162101
14 908559113
13 322385492
11 834962425
16 165992530
11 433180506
16 4759785...

output:

Y

result:

ok "Y"

Test #37:

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

input:

13341
17 575531812
16 812681630
12 111512035
15 479171729
19 978744476
19 556563288
16 610537682
19 968656754
15 574478969
12 683802855
15 629972153
19 353901743
14 333755634
19 585500499
18 196027392
17 650038228
12 884671935
18 725813964
17 478445777
11 393677779
17 170875038
16 955239716
16 99626...

output:

Y

result:

ok "Y"

Test #38:

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

input:

13321
16 909100950
11 847402133
14 434350101
18 850055625
15 135667242
18 990963397
13 805262901
11 343973557
17 315276589
15 984395810
19 586697464
14 390561635
16 19630588
12 391007314
16 951089141
14 966630723
17 819660296
11 315591474
15 55395352
18 949816635
15 131000665
12 177916238
17 1197798...

output:

Y

result:

ok "Y"

Test #39:

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

input:

68
3448 155326962
2775 744649850
2584 703469214
3433 520155412
2830 14193326
2992 558137552
3137 49376782
2769 664487544
2857 839005482
2647 799224188
2710 537147422
3150 145331662
3285 949553500
2795 527751840
2678 911771266
3469 108548958
2627 395613974
3357 985736486
2648 940557730
3323 592921196...

output:

Y

result:

ok "Y"

Test #40:

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

input:

68
2548 515768832
2860 311878656
2550 448598016
2586 358838784
2845 678841344
3227 972887040
3109 303952896
2626 985370112
3253 469006848
3448 277996032
2671 974274048
3113 717479424
3063 964961280
3324 56074752
2898 622370304
2510 738482688
2814 904725504
2992 555595776
2654 974670336
3461 19319040...

output:

Y

result:

ok "Y"

Test #41:

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

input:

65
3455 816018686
3493 395812886
3463 7679270
2606 962803670
3416 302502044
3347 296835614
2927 792818748
2632 798937218
3478 778613358
2797 702659638
2795 359362932
3107 381876626
2910 580939302
3186 849928742
3233 626443076
3207 869868340
2579 219445050
2890 527633090
2734 664183398
2777 485493534...

output:

N

result:

ok "N"

Test #42:

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

input:

68
2936 782643170
3197 174805508
3421 653355402
2760 704571460
3432 26412986
2573 875187446
2660 182269186
3490 669187848
2872 260208598
2597 303845546
2996 982365170
3070 745644794
2927 952689210
3087 460942372
3453 136566574
2876 913118736
2767 789935564
2533 707188108
2740 527634166
2915 88821962...

output:

N

result:

ok "N"

Test #43:

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

input:

66
2924 749849975
3345 492152262
3348 15900857
3115 111017263
3058 434290654
3298 252904967
2507 785862882
3227 999914300
3238 132325186
3033 480422320
3360 479710441
3157 659685117
2734 937497897
2557 44984282
2807 964386738
3157 19572483
2754 342318088
3227 752210445
2858 7027111
3404 27422647
261...

output:

Y

result:

ok "Y"

Test #44:

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

input:

67
3406 50782584
3049 254787224
2686 728438760
2889 210009136
3073 956709536
2913 103555640
2868 336991560
3465 672149976
2640 585058016
3072 965029544
2941 958474880
3119 513123928
3133 276972008
3459 94157912
3035 862244896
3207 428964224
2552 353459736
3490 617474944
2864 346473296
3169 533223112...

output:

N

result:

ok "N"

Test #45:

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

input:

65
3393 557010000
3419 788470000
3108 951260000
3316 428750000
3336 544600000
2747 712040000
2716 551020000
2973 386640000
2661 531070000
3371 112300000
2755 419070000
3018 32420000
2932 311340000
3400 815990000
3325 516440000
2999 964520000
3335 860540000
3229 453070000
2959 686440000
2989 81726000...

output:

N

result:

ok "N"

Test #46:

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

input:

67
2874 6480000
2503 993490000
3073 658970000
3471 267710000
2740 99310000
2974 386080000
3450 888330000
2830 227630000
3438 507270000
3410 41850000
2716 672180000
3362 873260000
3330 60880000
3309 884140000
3172 133940000
2668 889470000
2513 986070000
2864 228160000
2965 182200000
3127 205810000
33...

output:

N

result:

ok "N"

Test #47:

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

input:

67
2678 579466100
3346 87018800
3357 450124520
3182 125583950
2703 856146330
2569 860892810
3294 390002440
2984 836567100
2855 367258890
2577 822723200
3426 64473020
2710 769523070
3451 108971270
3189 380311710
3400 72383820
2912 470297060
3188 973423940
2619 33818670
2587 365478960
3017 58342150
25...

output:

Y

result:

ok "Y"

Test #48:

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

input:

67
3399 514654560
3050 627036690
2694 514257450
3337 272218905
3339 230323800
3176 877811655
3274 424113480
3461 533120175
2630 280558215
3378 375467505
2634 710032680
2673 485864085
2856 475936335
2709 249782190
2619 940157925
2581 655430055
3367 353427900
2644 287706195
2974 257327280
3155 9163313...

output:

Y

result:

ok "Y"

Test #49:

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

input:

67
3159 297505653
2830 80553022
3228 669690826
2621 843357306
2650 235394234
3080 902951538
3165 421469281
3408 845298933
2897 189899634
2759 957798233
2766 921374062
3124 671780563
3431 536167954
2786 885058824
2902 275038224
3394 74955235
2603 494467330
3277 840766121
2872 888230555
2911 202872393...

output:

Y

result:

ok "Y"

Test #50:

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

input:

67
2640 926042087
2535 410240820
2574 697561597
2776 214241201
2665 242573897
3315 337351647
3137 321227204
2884 75391544
2672 930697254
3179 108648084
2727 173066668
2856 708440455
2829 76818716
3315 985532935
3122 735132678
3063 96580434
3403 134488395
2539 285319438
2878 465180131
3048 904235441
...

output:

Y

result:

ok "Y"

Test #51:

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

input:

66
2629 941006969
3303 231920255
2502 623069706
3131 332780049
2664 52612294
2658 77620228
3365 231375305
3002 22470896
2657 682926363
3233 754258750
3323 793744987
3174 949235735
3256 69809040
2785 808960614
3477 17145163
3345 490886767
2770 324907653
3233 827932007
2622 747228636
2536 426373612
30...

output:

Y

result:

ok "Y"

Test #52:

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

input:

68
3111 222933305
3007 852907027
3461 362837692
2904 939948905
2688 403917591
3266 125771646
2725 421149092
2859 532754565
3060 705482953
3034 939801401
2903 497411208
2898 263270287
2653 994301126
3306 511441973
2696 716350236
3014 478873927
2576 366392152
3257 810521572
3010 822950198
3294 1018038...

output:

Y

result:

ok "Y"

Test #53:

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

input:

68
2955 357944202
2562 478262169
2857 388321164
3190 114858513
2674 799910001
2904 416378358
2932 230976900
2962 854814510
2591 329767020
2705 464863509
3316 619028091
3192 701099883
2936 336316365
2741 840025989
3014 438576138
2559 703409652
2978 849595032
3159 745905402
2652 692540739
3321 6540245...

output:

Y

result:

ok "Y"

Test #54:

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

input:

67
3056 769982994
3268 692070786
2823 894810510
2963 2469753
3310 472412754
3139 297210276
3285 769992993
2819 754534539
3368 16998300
2744 226757322
2515 677492244
3155 970792911
3343 243765621
2650 840275964
2614 384231573
3229 44425557
3166 829936998
2803 830846907
2659 873882603
3459 582181776
3...

output:

Y

result:

ok "Y"

Test #55:

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

input:

13
18129 513314326
11698 736734306
10701 750491262
17837 884798480
16693 501195314
19950 134778896
16949 434971750
16919 902832908
18338 605767816
15970 511250902
10458 291359046
12012 694869944
11493 493802002

output:

N

result:

ok "N"

Test #56:

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

input:

13
10630 791377665
11357 896237923
11764 951162230
18544 99322007
14085 979965061
16033 467147372
18902 242545782
12082 692214074
17222 603476863
17302 567126570
10056 182339415
19752 888085734
18845 197632008

output:

Y

result:

ok "Y"

Test #57:

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

input:

10
104 76
18 18
35 74
104 101
85 104
45 92
28 11
98 53
72 7
14 23

output:

Y

result:

ok "Y"

Test #58:

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

input:

10
61 14
99 14
108 105
63 14
28 49
4 7
74 98
114 70
54 84
34 14

output:

Y

result:

ok "Y"

Test #59:

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

input:

13
195 77
14 42
30 53
149 4
74 27
31 33
67 6
165 12
51 77
8 73
167 95
19 99
150 52

output:

Y

result:

ok "Y"

Test #60:

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

input:

13
47 65
65 78
173 91
59 91
123 39
100 52
189 26
110 39
126 13
187 39
45 13
98 78
20 91

output:

Y

result:

ok "Y"

Test #61:

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

input:

42
360 271
40 9
263 122
358 38
234 3
279 251
12 259
40 100
382 283
196 55
147 187
403 120
375 236
168 267
59 154
367 137
188 126
91 152
137 22
203 14
245 299
280 134
305 183
53 41
226 112
237 128
233 239
380 90
395 142
359 189
33 127
24 268
348 53
15 115
139 56
265 46
308 288
180 199
119 149
277 300...

output:

Y

result:

ok "Y"

Test #62:

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

input:

42
391 210
399 126
380 252
388 126
175 252
193 210
397 84
403 294
318 126
152 294
101 126
265 126
293 168
166 252
69 210
167 42
382 42
344 126
4 294
20 84
252 252
193 294
67 168
137 210
384 126
68 294
303 210
347 252
314 126
86 252
173 210
242 168
145 252
187 168
133 294
174 42
339 84
284 210
360 12...

output:

N

result:

ok "N"

Test #63:

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

input:

345
98 29
259 50
12 294
101 219
66 36
362 215
102 175
282 187
313 177
171 221
267 45
228 148
6 3
67 187
380 280
278 251
74 160
16 3
258 297
400 293
111 229
323 275
2 57
314 201
19 48
181 33
175 236
14 61
343 88
94 141
60 278
321 99
110 147
79 219
164 101
372 24
279 50
154 121
200 96
71 202
13 27
282...

output:

Y

result:

ok "Y"

Test #64:

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

input:

345
245 204
86 289
200 289
241 255
373 85
72 119
240 102
286 187
246 170
262 187
404 221
33 34
307 204
230 17
40 204
268 238
137 255
340 85
296 221
394 255
336 85
14 255
308 34
93 255
87 68
256 85
123 272
231 119
221 153
155 102
267 238
221 272
370 204
284 34
9 119
106 289
278 204
103 238
299 272
20...

output:

Y

result:

ok "Y"

Test #65:

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

input:

1337
1 188
1 237
21 276
0 75
10 132
25 109
56 79
1 284
173 114
0 236
346 293
4 276
1 128
1 54
266 226
168 188
0 70
11 64
132 299
97 11
200 112
67 48
389 246
43 42
8 87
305 298
8 172
31 231
1 174
212 37
0 57
9 144
380 100
44 42
39 95
1 214
5 175
8 95
15 277
222 100
129 69
11 99
9 86
38 279
4 214
5 12...

output:

Y

result:

ok "Y"

Test #66:

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

input:

1337
15 540072962
9 45396417
47 502359347
0 890654525
0 516789863
1 575954708
55 863616271
17 212904546
1081 509817925
0 598758316
1 192989531
0 749849581
0 346148768
0 244588390
0 624393268
36 673205736
0 954587087
0 944574056
2 962697104
0 648443950
0 588584666
0 511975269
0 28087114
0 45978559
1 ...

output:

Y

result:

ok "Y"

Test #67:

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

input:

10000
0 416632616
0 242652505
0 256480157
0 130932491
1 754018519
0 316920871
0 606604
0 634418958
0 257400758
0 27836907
0 124230691
0 980841427
0 958833438
0 561604994
1 197305420
2 604172250
8 567418159
0 906271000
0 636143717
0 939350436
54 285603495
0 731424681
0 909784885
0 828049190
0 8998312...

output:

Y

result:

ok "Y"

Test #68:

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

input:

10000
0 679228581
0 651089126
0 342239203
0 263231924
0 334101745
0 9537586
0 955083403
1 544674420
0 11799694
0 724647984
0 897633615
0 320545865
0 90781297
1 548954714
0 184304555
1 620063872
0 528675390
0 408284556
0 345928818
0 415988404
0 742043343
0 551016392
0 101016065
0 204862123
3 97695215...

output:

Y

result:

ok "Y"

Test #69:

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

input:

100000
0 752910201
0 216723901
0 974414966
0 852704979
0 928211175
0 741804459
1 900822887
0 978734900
0 587791992
1 474197602
0 587347512
0 652990949
0 772988347
0 596072256
0 251105070
0 555668128
0 635170304
0 866112343
0 541048736
0 234935113
0 492905471
0 532876788
0 356806920
0 387928787
0 762...

output:

Y

result:

ok "Y"

Test #70:

score: 0
Accepted
time: 6ms
memory: 3620kb

input:

100000
0 715468149
0 237832263
0 182646504
0 254514897
0 149909607
0 217305477
0 562884885
0 816623559
0 266885181
0 288791919
0 697060575
1 448927956
0 901071693
0 298796571
0 14403249
0 946918134
0 311499522
0 199230570
0 72977283
0 420195384
0 384723225
0 492371802
0 356754555
0 91742166
0 719669...

output:

Y

result:

ok "Y"

Test #71:

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

input:

200000
0 859573238
0 412146741
0 204964332
0 683795962
0 765602519
0 582124151
0 465369231
0 288154691
0 6405933
0 924823635
0 873371908
0 200824256
0 425380565
0 621189649
0 765976529
0 407360831
0 122778397
0 233345428
1 576634666
0 715816143
0 635127645
0 352037080
0 662706089
0 961034674
0 37807...

output:

Y

result:

ok "Y"

Test #72:

score: 0
Accepted
time: 6ms
memory: 3576kb

input:

200000
0 665832299
7 265962290
0 962548180
0 521005672
0 725504109
0 484761519
0 316118385
0 53892388
0 299372282
0 762299318
0 375657986
0 968060962
0 770188529
0 880809688
0 24594207
0 85928073
0 797655782
0 139660477
0 949871670
0 650208306
0 610844465
0 286724658
0 195981511
0 102864157
0 744103...

output:

Y

result:

ok "Y"

Test #73:

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

input:

3
0 3
1 6
2 9

output:

Y

result:

ok "Y"

Test #74:

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

input:

3
1 3
1 6
1 9

output:

N

result:

ok "N"

Test #75:

score: 0
Accepted
time: 6ms
memory: 3608kb

input:

200000
1 1000000000
1 1000000000
1 1000000000
1 1000000000
1 1000000000
1 1000000000
1 1000000000
1 1000000000
1 1000000000
1 1000000000
1 1000000000
1 1000000000
1 1000000000
1 1000000000
1 1000000000
1 1000000000
1 1000000000
1 1000000000
1 1000000000
1 1000000000
1 1000000000
1 1000000000
1 10000...

output:

Y

result:

ok "Y"

Test #76:

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

input:

200000
7 1000000000
7 1000000000
7 1000000000
7 1000000000
7 1000000000
7 1000000000
7 1000000000
7 1000000000
7 1000000000
7 1000000000
7 1000000000
7 1000000000
7 1000000000
7 1000000000
7 1000000000
7 1000000000
7 1000000000
7 1000000000
7 1000000000
7 1000000000
7 1000000000
7 1000000000
7 10000...

output:

N

result:

ok "N"

Test #77:

score: 0
Accepted
time: 6ms
memory: 3600kb

input:

200000
7 14
7 14
7 14
7 14
7 14
7 14
7 14
7 14
7 14
7 14
7 14
7 14
7 14
7 14
7 14
7 14
7 14
7 14
7 14
7 14
7 14
7 14
7 14
7 14
7 14
7 14
7 14
7 14
7 14
7 14
7 14
7 14
7 14
7 14
7 14
7 14
7 14
7 14
7 14
7 14
7 14
7 14
7 14
7 14
7 14
7 14
7 14
7 14
7 14
7 14
7 14
7 14
7 14
7 14
7 14
7 14
7 14
7 14
7 1...

output:

N

result:

ok "N"

Test #78:

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

input:

200000
7 21
7 21
7 21
7 21
7 21
7 21
7 21
7 21
7 21
7 21
7 21
7 21
7 21
7 21
7 21
7 21
7 21
7 21
7 21
7 21
7 21
7 21
7 21
7 21
7 21
7 21
7 21
7 21
7 21
7 21
7 21
7 21
7 21
7 21
7 21
7 21
7 21
7 21
7 21
7 21
7 21
7 21
7 21
7 21
7 21
7 21
7 21
7 21
7 21
7 21
7 21
7 21
7 21
7 21
7 21
7 21
7 21
7 21
7 2...

output:

Y

result:

ok "Y"

Test #79:

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

input:

3337
3 10000
3 10000
3 10000
3 10000
3 10000
3 10000
3 10000
3 10000
3 10000
3 10000
3 10000
3 10000
3 10000
3 10000
3 10000
3 10000
3 10000
3 10000
3 10000
3 10000
3 10000
3 10000
3 10000
3 10000
3 10000
3 10000
3 10000
3 10000
3 10000
3 10000
3 10000
3 10000
3 10000
3 10000
3 10000
3 10000
3 10000...

output:

N

result:

ok "N"

Test #80:

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

input:

3337
3 70025
3 70025
3 70025
3 70025
3 70025
3 70025
3 70025
3 70025
3 70025
3 70025
3 70025
3 70025
3 70025
3 70025
3 70025
3 70025
3 70025
3 70025
3 70025
3 70025
3 70025
3 70025
3 70025
3 70025
3 70025
3 70025
3 70025
3 70025
3 70025
3 70025
3 70025
3 70025
3 70025
3 70025
3 70025
3 70025
3 70025...

output:

Y

result:

ok "Y"

Extra Test:

score: 0
Extra Test Passed