QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#83551#1867. Medianwoxiangbaile#AC ✓138ms14360kbC++1.0kb2023-03-02 14:54:032023-03-02 14:54:10

Judging History

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

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2023-03-02 14:54:10]
  • 评测
  • 测评结果:AC
  • 用时:138ms
  • 内存:14360kb
  • [2023-03-02 14:54:03]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
const int maxn=2e6+10;
const int mod=1e9+7;
#define inf 1e9
#define ll long long
inline int read(){
	int x=0,f=1;char c=getchar();
	while(c<'0'||c>'9'){if(c=='-')f=-1;c=getchar();}
	while(c>='0'&&c<='9'){x=(x<<1)+(x<<3)+c-'0';c=getchar();}
	return x*f;
}
int n,m,a[maxn],b[maxn],T,id[maxn];
ll A[maxn],B[maxn];
inline void solve(){
	n=read();int top=0;
	for(int i=1;i<=n;i++)
		a[i]=read(),b[i]=read(),A[i]=B[i]=0;
	for(int i=1;i<=n;i++){
		if(i==1||((!a[i])^(!a[i-1])))++top,id[top]=i;
		if(!a[i])B[top]+=b[i];else A[top]+=b[i];
	}ll sum=0;int pos=0;
//	for(int i=1;i<=top;i++)
//		printf("%d %lld %lld\n",id[i],A[i],B[i]);
	for(int i=1;i<=top;i++)sum+=B[i];
	for(int i=1;i<=top;i++)
		if(B[i]>sum-B[i]){pos=i;break;}
	if(!pos)return void(puts("YES"));
	sum=B[pos]-(sum-B[pos]);
	for(int i=1;i<=n;i++)if(a[i]){
		if(i<=id[pos])sum-=b[i];
		else sum-=(b[i]-a[i]);
	}puts(sum>0?"NO":"YES");
}
int main(){
	T=read();
	while(T--)solve();
	return 0;
}

詳細信息

Test #1:

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

input:

3
4
1 1
1 1
1 1
1 1
4
1 1
0 1
1 1
1 1
4
0 1
1 1
1 1
1 1

output:

YES
YES
NO

result:

ok 3 token(s): yes count is 2, no count is 1

Test #2:

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

input:

2
100000
167959139 481199252
336470888 634074578
642802746 740396295
579721198 773386884
396628655 503722503
202647942 971207868
2087506 268792718
46761498 443917727
16843338 125908043
691952768 717268783
150414369 787375312
519096230 693319712
45277106 856168102
674936674 762263554
274667941 407246...

output:

YES
YES

result:

ok 2 token(s): yes count is 2, no count is 0

Test #3:

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

input:

2
100000
54748096 641009859
75475634 804928248
284875072 476927808
503158867 627937890
322595515 786026685
645468307 669240390
588586447 939887597
521365644 973764525
710156469 985188306
11308832 860350786
770562147 784695957
35937909 208427221
67590963 726478310
255361535 475357775
135993561 166967...

output:

YES
YES

result:

ok 2 token(s): yes count is 2, no count is 0

Test #4:

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

input:

2
100000
524125987 923264237
374288891 535590429
124321145 751244358
232930851 266089174
543529670 773363571
319728747 580543238
468188689 582720391
490702144 598813561
138628383 284660056
155605777 733781508
245485733 931759705
257812292 723534730
596788519 794937524
188451996 981010588
14483682 59...

output:

YES
YES

result:

ok 2 token(s): yes count is 2, no count is 0

Test #5:

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

input:

1000
100000
1 1
0 1
1 1
0 1
1 1
0 1
1 1
0 1
1 1
0 1
1 1
0 1
1 1
0 1
1 1
0 1
1 1
0 1
1 1
0 1
1 1
0 1
1 1
0 1
1 1
0 1
1 1
0 1
1 1
0 1
1 1
0 1
1 1
0 1
1 1
0 1
1 1
0 1
1 1
0 1
1 1
0 1
1 1
0 1
1 1
0 1
1 1
0 1
1 1
0 1
1 1
0 1
1 1
0 1
1 1
0 1
1 1
0 1
1 1
0 1
1 1
0 1
1 1
0 1
1 1
0 1
1 1
0 1
1 1
0 1
1 1
0 1
...

output:

NO
NO
YES
NO
NO
YES
NO
YES
YES
YES
YES
YES
YES
YES
NO
NO
YES
YES
YES
YES
NO
YES
YES
YES
YES
NO
YES
YES
YES
NO
YES
YES
NO
YES
YES
YES
NO
YES
YES
YES
YES
NO
YES
NO
YES
YES
NO
YES
NO
NO
NO
YES
YES
YES
YES
NO
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
NO
NO
YES
YES
NO
YES
YES
YES
YES
NO
NO
YES
NO
NO
YE...

result:

ok 1000 token(s): yes count is 632, no count is 368

Test #6:

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

input:

1000
100000
1 1
0 1
1 1
0 1
1 1
0 1
1 1
0 1
1 1
0 1
1 1
0 1
1 1
0 1
1 1
0 1
1 1
0 1
1 1
0 1
1 1
0 1
1 1
0 1
1 1
0 1
1 1
0 1
1 1
0 1
1 1
0 1
1 1
0 1
1 1
0 1
1 1
0 1
1 1
0 1
1 1
0 1
1 1
0 1
1 1
0 1
1 1
0 1
1 1
0 1
1 1
0 1
1 1
0 1
1 1
0 1
1 1
0 1
1 1
0 1
1 1
0 1
1 1
0 1
1 1
0 1
1 1
0 1
1 1
0 1
1 1
0 1
...

output:

NO
NO
YES
NO
NO
YES
NO
YES
YES
YES
YES
YES
YES
YES
NO
NO
YES
YES
YES
YES
NO
YES
YES
YES
YES
NO
YES
YES
YES
NO
YES
YES
NO
YES
YES
YES
NO
YES
YES
YES
YES
NO
YES
NO
YES
YES
NO
YES
NO
NO
NO
YES
YES
YES
YES
NO
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
NO
NO
YES
YES
NO
YES
YES
YES
YES
NO
NO
YES
NO
NO
YE...

result:

ok 1000 token(s): yes count is 632, no count is 368

Test #7:

score: 0
Accepted
time: 45ms
memory: 12292kb

input:

1000
100000
1 1
0 1
1 1
0 1
1 1
0 1
1 1
0 1
1 1
0 1
1 1
0 1
1 1
0 1
1 1
0 1
1 1
0 1
1 1
0 1
1 1
0 1
1 1
0 1
1 1
0 1
1 1
0 1
1 1
0 1
1 1
0 1
1 1
0 1
1 1
0 1
1 1
0 1
1 1
0 1
1 1
0 1
1 1
0 1
1 1
0 1
1 1
0 1
1 1
0 1
1 1
0 1
1 1
0 1
1 1
0 1
1 1
0 1
1 1
0 1
1 1
0 1
1 1
0 1
1 1
0 1
1 1
0 1
1 1
0 1
1 1
0 1
...

output:

NO
NO
YES
NO
NO
YES
NO
YES
YES
YES
YES
YES
YES
YES
NO
NO
YES
YES
YES
YES
NO
YES
YES
YES
YES
NO
YES
YES
YES
NO
YES
YES
NO
YES
YES
YES
NO
YES
YES
YES
YES
NO
YES
NO
YES
YES
NO
YES
NO
NO
NO
YES
YES
YES
YES
NO
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
NO
NO
YES
YES
NO
YES
YES
YES
YES
NO
NO
YES
NO
NO
YE...

result:

ok 1000 token(s): yes count is 632, no count is 368

Test #8:

score: 0
Accepted
time: 83ms
memory: 12052kb

input:

40
50000
0 167959139
0 134074578
0 273386884
0 3722503
0 2087506
0 443917727
0 191952768
0 150414369
0 45277106
0 174936674
0 279198849
0 421436316
0 140515506
0 451394766
0 195984050
0 254786900
0 17672277
0 228874183
0 25408976
0 166546966
0 109238004
0 283615461
0 23051181
0 354261286
0 433389755...

output:

NO
NO
NO
YES
YES
YES
NO
NO
NO
NO
NO
NO
NO
YES
NO
YES
NO
NO
NO
NO
NO
NO
NO
NO
YES
NO
NO
YES
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO

result:

ok 40 token(s): yes count is 7, no count is 33

Test #9:

score: 0
Accepted
time: 86ms
memory: 12052kb

input:

40
50000
0 141009859
0 304928248
0 3158867
0 286026685
0 439887597
0 21365644
0 360350786
0 270562147
0 67590963
0 255361535
0 46718075
0 288412453
0 206350235
0 488895277
0 208182535
0 51380687
0 436362895
0 316284722
0 108369168
0 302593587
0 346800220
0 222602739
0 422573158
0 328864420
0 6391006...

output:

NO
NO
NO
YES
NO
NO
NO
NO
NO
NO
NO
NO
YES
NO
NO
YES
YES
NO
NO
NO
NO
NO
YES
NO
YES
NO
NO
NO
NO
YES
NO
NO
NO
NO
YES
NO
NO
NO
YES
NO

result:

ok 40 token(s): yes count is 9, no count is 31

Test #10:

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

input:

40
50000
0 24125987
0 35590429
0 232930851
0 273363571
0 82720391
0 98813561
0 233781508
0 245485733
0 294937524
0 481010588
0 459461493
0 450355885
0 477217669
0 81685387
0 165091420
0 437909067
0 150020809
0 168536478
0 396362064
0 143672912
0 24553923
0 16365825
0 381903647
0 8500258
0 399463081
...

output:

NO
NO
NO
NO
YES
NO
NO
YES
NO
YES
NO
NO
NO
NO
NO
YES
NO
YES
NO
YES
YES
YES
YES
NO
NO
NO
NO
NO
NO
YES
NO
NO
NO
NO
NO
NO
YES
YES
NO
NO

result:

ok 40 token(s): yes count is 12, no count is 28

Test #11:

score: 0
Accepted
time: 102ms
memory: 13960kb

input:

40
50000
0 167959139
0 134074578
0 273386884
0 3722503
0 2087506
0 443917727
0 191952768
0 150414369
0 45277106
0 174936674
0 279198849
0 421436316
0 140515506
0 451394766
0 195984050
0 254786900
0 17672277
0 228874183
0 25408976
0 166546966
0 109238004
0 283615461
0 23051181
0 354261286
0 433389755...

output:

NO
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
NO
YES
YES
NO
NO
NO
NO
NO
YES
YES
YES
YES
YES
YES
NO
YES
NO
NO
YES
NO
NO
NO
NO
NO
YES
YES

result:

ok 40 token(s): yes count is 25, no count is 15

Test #12:

score: 0
Accepted
time: 107ms
memory: 11832kb

input:

40
50000
0 141009859
0 304928248
0 3158867
0 286026685
0 439887597
0 21365644
0 360350786
0 270562147
0 67590963
0 255361535
0 46718075
0 288412453
0 206350235
0 488895277
0 208182535
0 51380687
0 436362895
0 316284722
0 108369168
0 302593587
0 346800220
0 222602739
0 422573158
0 328864420
0 6391006...

output:

NO
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
NO
YES
YES
NO
YES
YES
YES
NO
YES
YES
NO
YES
NO
YES
YES
NO
NO
NO
YES
NO
YES
NO
NO
YES
YES
NO
YES
YES
NO

result:

ok 40 token(s): yes count is 26, no count is 14

Test #13:

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

input:

40
50000
0 24125987
0 35590429
0 232930851
0 273363571
0 82720391
0 98813561
0 233781508
0 245485733
0 294937524
0 481010588
0 459461493
0 450355885
0 477217669
0 81685387
0 165091420
0 437909067
0 150020809
0 168536478
0 396362064
0 143672912
0 24553923
0 16365825
0 381903647
0 8500258
0 399463081
...

output:

YES
YES
YES
YES
YES
YES
NO
YES
NO
YES
YES
YES
YES
NO
NO
YES
YES
YES
YES
YES
YES
YES
YES
YES
NO
YES
NO
NO
NO
YES
NO
NO
YES
YES
NO
NO
YES
YES
YES
NO

result:

ok 40 token(s): yes count is 27, no count is 13

Test #14:

score: 0
Accepted
time: 109ms
memory: 11836kb

input:

40
50000
0 167959139
0 134074578
0 273386884
0 3722503
0 2087506
0 443917727
0 191952768
0 150414369
0 45277106
0 174936674
0 279198849
0 421436316
0 140515506
0 451394766
0 195984050
0 254786900
0 17672277
0 228874183
0 25408976
0 166546966
0 109238004
0 283615461
0 23051181
0 354261286
0 433389755...

output:

NO
NO
NO
YES
YES
NO
NO
NO
NO
NO
NO
YES
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
YES
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO

result:

ok 40 token(s): yes count is 4, no count is 36

Test #15:

score: 0
Accepted
time: 81ms
memory: 11912kb

input:

40
50000
0 141009859
0 304928248
0 3158867
0 286026685
0 439887597
0 21365644
0 360350786
0 270562147
0 67590963
0 255361535
0 46718075
0 288412453
0 206350235
0 488895277
0 208182535
0 51380687
0 436362895
0 316284722
0 108369168
0 302593587
0 346800220
0 222602739
0 422573158
0 328864420
0 6391006...

output:

NO
NO
NO
NO
NO
YES
NO
NO
NO
NO
NO
NO
YES
NO
NO
YES
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO

result:

ok 40 token(s): yes count is 3, no count is 37

Test #16:

score: 0
Accepted
time: 105ms
memory: 13916kb

input:

40
50000
0 24125987
0 35590429
0 232930851
0 273363571
0 82720391
0 98813561
0 233781508
0 245485733
0 294937524
0 481010588
0 459461493
0 450355885
0 477217669
0 81685387
0 165091420
0 437909067
0 150020809
0 168536478
0 396362064
0 143672912
0 24553923
0 16365825
0 381903647
0 8500258
0 399463081
...

output:

NO
NO
NO
NO
YES
NO
NO
YES
NO
NO
NO
NO
NO
NO
NO
YES
NO
NO
NO
NO
YES
NO
NO
NO
NO
NO
NO
NO
NO
YES
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO

result:

ok 40 token(s): yes count is 5, no count is 35

Test #17:

score: 0
Accepted
time: 134ms
memory: 11672kb

input:

1000
2000
0 451953136
0 485975839
0 160142331
0 234629087
0 27349554
0 234663164
0 424084411
0 432436087
0 218181396
0 310566118
0 95980426
0 83790579
0 322848195
0 342298331
0 325462325
0 467560176
0 63849644
0 212299288
0 462875592
0 274601547
0 385573756
0 345253656
0 165603729
0 393860385
0 3110...

output:

YES
NO
NO
YES
YES
YES
NO
YES
YES
YES
NO
NO
YES
NO
YES
YES
YES
YES
YES
YES
YES
NO
YES
YES
NO
YES
YES
YES
NO
NO
YES
YES
YES
NO
YES
YES
YES
NO
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
NO
YES
YES
YES
YES
YES
YES
YES
NO
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
NO
YES
YES
YES
YES
YES
YES
YES
YES...

result:

ok 1000 token(s): yes count is 865, no count is 135

Test #18:

score: 0
Accepted
time: 89ms
memory: 11512kb

input:

1000
2000
0 395480339
0 276669252
0 245626437
0 174637010
0 387911728
0 62464112
0 385959668
0 330937906
0 459714232
0 83930735
0 232783395
0 167942210
0 354261219
412808714 898584519
0 185993258
0 257271530
0 458379307
0 44081482
0 426112674
0 18783828
0 302014025
0 238427256
0 438393700
0 6879976
...

output:

NO
NO
YES
YES
YES
YES
NO
YES
YES
YES
YES
YES
YES
YES
YES
NO
YES
YES
YES
YES
NO
YES
YES
YES
YES
NO
NO
YES
YES
NO
YES
YES
YES
NO
YES
YES
YES
YES
YES
YES
NO
YES
YES
NO
NO
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
NO
YES
YES
YES
NO
YES
YES
NO
YES
YES
YES
YES
NO
YES
...

result:

ok 1000 token(s): yes count is 836, no count is 164

Test #19:

score: 0
Accepted
time: 83ms
memory: 11512kb

input:

1000
2000
0 76784950
0 90894377
0 299541052
0 316774126
0 292218636
0 50542166
0 61932642
0 65935041
0 282695775
0 362182959
0 427504903
0 359174856
0 485472705
0 135643220
0 2767322
0 26419651
0 61700866
0 478875303
0 145082573
0 211018165
0 462987571
0 271530312
0 457971728
0 81153246
0 162971301
...

output:

YES
YES
NO
YES
NO
YES
NO
NO
YES
YES
NO
YES
YES
NO
YES
YES
YES
YES
YES
NO
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
NO
NO
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
NO
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
NO
YES
YES
YES...

result:

ok 1000 token(s): yes count is 861, no count is 139

Test #20:

score: 0
Accepted
time: 91ms
memory: 11508kb

input:

1000
2000
0 74166326
0 362329962
0 36143247
0 24710341
0 98730798
0 35489252
0 407643437
0 229439725
0 496214363
0 207552247
0 429394875
0 252093840
0 90706947
278286392 333464503
0 341491486
0 397239780
0 207684779
0 80896380
0 334060155
0 57933405
0 273743894
0 396442071
0 6150967
0 119899567
0 65...

output:

YES
YES
NO
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
NO
YES
YES
YES
YES
NO
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
NO
YES
NO
YES
NO
NO
YES
YES
YES
YES
YES
YES
NO
YES
YES
YES
YES
NO
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
NO
YES
YES
YES
YES
YES
YES
YES
YES
YES
NO
YES...

result:

ok 1000 token(s): yes count is 856, no count is 144

Test #21:

score: 0
Accepted
time: 91ms
memory: 11532kb

input:

1000
2000
0 216771895
0 78475947
0 212936931
0 172838044
0 405242960
0 315403635
0 253354232
0 392944409
0 59989848
0 112730048
0 431284848
0 294755929
0 255749702
0 125962268
0 34991459
0 268059908
0 298379092
0 182917456
0 23037738
0 259624452
0 29210618
0 166578022
0 494521694
0 158645889
0 28552...

output:

NO
YES
NO
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
NO
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
NO
YES
YES
YES
YES
NO
YES
YES
YES
YES
YES
NO
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
NO
NO
YES
YES
YES
NO
YES
YES
YES
YES
YES
NO
YE...

result:

ok 1000 token(s): yes count is 837, no count is 163

Test #22:

score: 0
Accepted
time: 121ms
memory: 11496kb

input:

1000
2000
0 214153271
0 144878829
0 449539126
0 380774260
0 356979314
0 155126529
0 99065027
0 406705990
0 68475732
0 17907848
0 287950628
0 187674914
0 215759752
0 473638144
0 228491431
0 493655845
0 34297597
0 79905829
0 212015320
0 461315499
0 134934238
0 291489780
0 247733638
0 492359507
0 22640...

output:

YES
YES
NO
YES
YES
YES
YES
YES
YES
NO
YES
YES
YES
YES
NO
YES
YES
NO
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
NO
YES
YES
YES
YES
YES
NO
YES
YES
NO
YES
YES
YES
YES
NO
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
NO
YES
YES
YES
YES
NO
YES
YES
YES
YES
YES
YES
YE...

result:

ok 1000 token(s): yes count is 858, no count is 142

Test #23:

score: 0
Accepted
time: 134ms
memory: 11532kb

input:

1000
2000
0 356758840
0 211281710
0 331365514
0 28901963
0 163491476
0 435040911
0 444775822
0 70210674
0 132251216
0 218052945
0 289840601
0 230337002
0 380802507
0 321314020
0 127024107
0 364475973
0 330024614
0 36702714
0 50736007
0 103198034
240657858 301971408
0 416401539
0 441137069
0 31105828...

output:

YES
YES
NO
YES
YES
YES
YES
YES
YES
YES
YES
NO
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
NO
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
NO
YES
YES
YES
YES
YES
YES
YES
NO
YES
NO
NO
YES
YES
YES
YES
YES
YES
YES
YES
NO
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
...

result:

ok 1000 token(s): yes count is 850, no count is 150

Test #24:

score: 0
Accepted
time: 88ms
memory: 11676kb

input:

1000
2000
0 457745749
0 352440197
0 57978429
0 485172989
0 421779995
0 128937703
0 308865039
0 209324869
0 478827806
0 269176893
0 110886576
0 38631577
0 96301584
0 272422472
0 103251952
0 70647003
0 65566946
0 147280649
0 340766176
0 457947435
0 280067780
0 204905920
0 17642961
0 42565610
0 2711726...

output:

YES
YES
YES
YES
YES
YES
YES
NO
YES
YES
NO
YES
YES
NO
YES
YES
YES
YES
YES
NO
YES
YES
YES
YES
NO
YES
YES
YES
NO
YES
YES
NO
YES
NO
YES
NO
YES
YES
YES
YES
NO
YES
YES
NO
YES
YES
YES
NO
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
NO
YES
YES
YES
YES
YES
YES
YES
YES
YES
NO
YES
YES
YES
YES
YES
YES
NO
YES
YES
YES...

result:

ok 1000 token(s): yes count is 865, no count is 135

Test #25:

score: 0
Accepted
time: 88ms
memory: 11536kb

input:

1000
2000
0 395318614
0 273618886
0 439804816
0 133300692
0 228292157
0 318917493
0 154575834
0 372829553
0 337570587
0 174354693
0 112776549
0 431550562
0 406568531
0 120098348
0 296751924
0 441467131
0 156261259
0 399044829
0 29743758
0 99829970
0 385791400
0 329817679
0 211046392
0 21503420
0 288...

output:

YES
YES
YES
NO
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
NO
YES
NO
NO
NO
YES
YES
YES
YES
YES
YES
NO
YES
YES
YES
YES
YES
YES
YES
NO
YES
YES
YES
YES
YES
NO
NO
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
NO
YES
YES
YES
YES
YES
YES
YES
YES
YES
NO
YES
NO
YES
NO
YES
YES
Y...

result:

ok 1000 token(s): yes count is 860, no count is 140

Test #26:

score: 0
Accepted
time: 116ms
memory: 11548kb

input:

1000
2000
0 392699990
0 45054472
0 176407012
0 46269612
0 180028511
0 98831875
0 286629
0 241366942
0 51089175
0 224756686
0 409633817
0 474212651
0 366578581
0 262741520
0 135476089
0 107254556
0 97212468
0 1065906
0 13688637
0 301521018
0 51323532
0 454729438
0 259225631
0 265282446
0 286496887
0 ...

output:

YES
YES
YES
YES
YES
YES
YES
YES
YES
NO
YES
YES
YES
YES
YES
YES
YES
YES
YES
NO
YES
YES
YES
YES
YES
YES
YES
YES
YES
NO
YES
YES
YES
YES
YES
YES
YES
YES
NO
YES
YES
YES
YES
YES
NO
YES
YES
YES
YES
NO
YES
YES
YES
YES
YES
YES
NO
YES
YES
YES
YES
NO
NO
YES
YES
YES
YES
YES
YES
NO
YES
YES
NO
YES
YES
YES
YES
YES...

result:

ok 1000 token(s): yes count is 839, no count is 161

Test #27:

score: 0
Accepted
time: 87ms
memory: 11676kb

input:

1000
2000
0 240338263
0 261200457
0 353200696
0 399430019
0 486540673
0 83778962
0 345997424
0 50095818
0 114864659
0 129934486
0 116556493
0 367131635
0 31621336
0 315450099
0 328976061
0 183107388
0 392939485
0 103086983
0 497633516
0 3212065
0 157047152
0 224865389
0 452629062
0 98996063
0 189383...

output:

YES
YES
YES
YES
NO
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
NO
YES
NO
YES
YES
YES
YES
YES
NO
NO
YES
YES
YES
YES
YES
NO
YES
YES
YES
YES
YES
NO
NO
YES
YES
YES
YES
YES
NO
YES
YES
YES
YES
YES
YES
YES
NO
NO
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
NO
...

result:

ok 1000 token(s): yes count is 846, no count is 154

Test #28:

score: 0
Accepted
time: 117ms
memory: 11516kb

input:

1000
2000
0 32686935
0 327603338
0 89802891
0 47557722
0 293052836
0 68726048
0 486675515
0 418633206
0 328383247
0 330079582
0 118446466
0 114826428
0 491631386
0 163125975
0 227508737
0 53927516
0 188666502
0 354851163
0 41386906
0 204903112
0 57738068
0 349777147
0 808302
0 432709681
0 447045317
...

output:

NO
NO
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
NO
YES
NO
YES
YES
YES
YES
YES
NO
YES
YES
YES
YES
YES
YES
YES
YES
NO
YES
YES
YES
YES
NO
YES
YES
YES
YES
YES
NO
YES
YES
YES
YES
YES
YES
YES
YES
NO
NO
NO
YES
YES
YES
YES
YES
YES
NO
YES
YES
YES
YES
YES
YES
NO
NO
YES
YES
YES
YES
YES
YES
YES
NO
YES...

result:

ok 1000 token(s): yes count is 869, no count is 131

Test #29:

score: 0
Accepted
time: 138ms
memory: 11492kb

input:

1000
2000
0 380325208
0 394006220
0 266596575
0 255493938
0 244789190
0 408448942
0 37419014
0 82137891
0 246934539
0 30224679
0 120336438
0 7745413
0 96865628
0 305769147
0 421008710
0 279523453
0 424585007
0 456872240
0 230364489
0 51818351
0 18237496
0 474688906
0 194211733
0 176488706
0 34993162...

output:

YES
YES
YES
NO
YES
YES
NO
NO
NO
YES
YES
NO
YES
YES
YES
YES
YES
YES
YES
YES
YES
NO
YES
YES
NO
NO
YES
YES
YES
YES
NO
YES
YES
YES
YES
NO
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
NO
YES
YES
NO
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
NO
YES
YES
YES
YES
YES
YES
YES
NO
YES
YES
NO
YES
YES
NO
NO
YES
Y...

result:

ok 1000 token(s): yes count is 815, no count is 185

Test #30:

score: 0
Accepted
time: 95ms
memory: 11508kb

input:

1000
2000
0 317898072
0 315184909
0 3198770
0 403621641
0 51301352
0 393396028
0 178097104
0 450675279
0 105677319
0 435402479
0 417193707
0 50407501
0 261908383
0 153445023
0 464765578
0 150343581
0 15279320
0 58893317
0 419342072
0 253509399
0 328993820
0 394567961
0 37358268
0 10202324
0 31262645...

output:

YES
YES
YES
YES
YES
YES
YES
NO
NO
NO
YES
YES
YES
YES
YES
YES
YES
YES
YES
NO
YES
YES
YES
NO
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
NO
YES
YES
YES
NO
YES
YES
YES
NO
NO
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
N...

result:

ok 1000 token(s): yes count is 836, no count is 164

Test #31:

score: 0
Accepted
time: 89ms
memory: 11516kb

input:

1000
2000
0 315279449
0 176555086
0 385025158
0 111557857
0 357813514
0 173310410
0 83616411
0 464436860
0 319195907
0 485804472
0 124116383
0 238293782
0 221918433
0 1120899
0 158265551
0 21163709
0 456230529
0 15690201
0 108319654
0 455200446
0 229684736
0 164703912
0 230761699
0 48948645
0 104800...

output:

YES
YES
YES
YES
YES
NO
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
NO
YES
YES
NO
YES
YES
YES
YES
YES
YES
NO
YES
YES
YES
YES
YES
YES
YES
YES
NO
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
NO
YES
NO
YES
NO
YES
YES
YES
YES
NO
YES
YES
YES
NO
NO
YES
YES
YES
YES
YES
YES
YES
YES
YES...

result:

ok 1000 token(s): yes count is 844, no count is 156

Test #32:

score: 0
Accepted
time: 96ms
memory: 11676kb

input:

1000
2000
0 457885017
0 447990672
0 266851545
0 169750968
0 309549868
0 158257497
0 224294502
0 127941544
0 177938687
0 390982272
0 126006356
0 131212767
0 181928484
0 348796775
0 351765523
0 391983838
0 251957546
0 117711278
0 447040341
0 97082981
0 190184164
289615670 505273036
0 278940938
0 27886...

output:

YES
YES
YES
NO
YES
YES
NO
YES
YES
YES
YES
NO
YES
YES
YES
YES
NO
YES
YES
YES
NO
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
NO
YES
YES
YES
YES
YES
YES
YES
NO
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
NO
YES
YES
YES
YES
YES
YES
NO
YES
YES
NO
YES
YES
YES
YES
YES
YES
YES
YES
YES
NO...

result:

ok 1000 token(s): yes count is 862, no count is 138

Test #33:

score: 0
Accepted
time: 81ms
memory: 11516kb

input:

1000
2000
0 455266394
0 369169361
0 298421037
0 317878671
0 116062030
0 438171879
0 275038001
0 291446228
0 391457275
0 91127368
0 422863624
0 378907560
0 287162726
0 491439947
0 45265495
0 57771262
0 192908755
0 14699650
0 430985220
0 298774029
0 295907783
0 414527429
0 267311666
0 271665480
0 1710...

output:

YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
NO
YES
YES
YES
YES
YES
YES
NO
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
NO...

result:

ok 1000 token(s): yes count is 853, no count is 147