QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#814112#9873. Last Chance: Threads of Despairzxx_parents_team_1#RE 117ms28764kbC++14865b2024-12-14 15:21:562024-12-14 15:21:57

Judging History

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

  • [2024-12-14 15:21:57]
  • 评测
  • 测评结果:RE
  • 用时:117ms
  • 内存:28764kb
  • [2024-12-14 15:21:56]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
#define ll long long
const ll N=1000007;
ll T,n,m,a[N],b[N],c[N],sum,cnt[N];
int main(){
	cin>>T;
	while(T--){
		ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
		cin>>n>>m;sum=0;
		for (int i=1;i<=n;++i) cin>>a[i];
		for (int i=1;i<=m;++i) cin>>b[i];
		sort(a+1,a+1+n);sort(b+1,b+1+m);
		for (int i=1;i<=n;++i) if (a[i]>1){sum+=n-i+1;break;}
		sum+=(a[1]==1);
		for (int i=1;i<=n;++i){
			--a[i];
			if (a[i]<=n+m) ++cnt[a[i]];
		}
		int p=0,tmp=0;
		for (int i=0;i<=n+m;++i){
			if (i<=p) p+=cnt[i];
			if (i==p){
				c[++tmp]=i;
				++p;
				if (tmp==m) break;
			}
		}
//		for (int i=1;i<=m;++i) cout<<c[i]<<' ';cout<<'\n';
		for (int i=1;i<=m;++i) sum-=max(0ll,b[i]-c[i]);
		if (sum>=0) cout<<"YES\n";
		else cout<<"NO\n";
		for (int i=1;i<=n;++i) cnt[a[i]]=0;
	}
	return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 1ms
memory: 9740kb

input:

3
3 2
1 1 4
2 6
3 2
1 1 4
2 7
2 1
100 100
2

output:

YES
NO
YES

result:

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

Test #2:

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

input:

3
7 1
1 1 1 1 1 1 1
9
5 2
3 4 5 6 7
1 6
5 3
3 4 5 6 7
1 5 7

output:

NO
NO
YES

result:

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

Test #3:

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

input:

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

output:

YES
YES
YES
NO

result:

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

Test #4:

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

input:

18
1 2
1
1 1
1 2
1
2 1
1 2
1
1 3
1 2
1
2 2
1 2
1
3 2
1 2
1
3 3
1 2
2
1 1
1 2
2
1 2
1 2
2
1 3
1 2
2
2 2
1 2
2
2 3
1 2
2
3 3
1 2
3
1 1
1 2
3
1 2
1 2
3
1 3
1 2
3
2 2
1 2
3
3 2
1 2
3
3 3

output:

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

result:

ok 18 token(s): yes count is 7, no count is 11

Test #5:

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

input:

18
2 1
1 1
1
2 1
1 1
2
2 1
1 1
3
2 1
1 2
1
2 1
2 1
2
2 1
2 1
3
2 1
1 3
1
2 1
1 3
2
2 1
3 1
3
2 1
2 2
1
2 1
2 2
2
2 1
2 2
3
2 1
2 3
1
2 1
3 2
2
2 1
2 3
3
2 1
3 3
1
2 1
3 3
2
2 1
3 3
3

output:

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

result:

ok 18 token(s): yes count is 15, no count is 3

Test #6:

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

input:

525
2 3
1 1
1 1 1
2 3
1 1
1 2 1
2 3
1 1
1 3 1
2 3
1 1
1 4 1
2 3
1 1
5 1 1
2 3
1 1
2 2 1
2 3
1 1
3 1 2
2 3
1 1
1 2 4
2 3
1 1
2 1 5
2 3
1 1
3 3 1
2 3
1 1
4 3 1
2 3
1 1
3 5 1
2 3
1 1
4 4 1
2 3
1 1
4 5 1
2 3
1 1
1 5 5
2 3
1 1
2 2 2
2 3
1 1
2 3 2
2 3
1 1
2 2 4
2 3
1 1
2 5 2
2 3
1 1
3 2 3
2 3
1 1
3 2 4
2 ...

output:

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

result:

ok 525 token(s): yes count is 202, no count is 323

Test #7:

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

input:

525
3 2
1 1 1
1 1
3 2
1 1 1
2 1
3 2
1 1 1
3 1
3 2
1 1 1
1 4
3 2
1 1 1
1 5
3 2
1 1 1
2 2
3 2
1 1 1
2 3
3 2
1 1 1
4 2
3 2
1 1 1
2 5
3 2
1 1 1
3 3
3 2
1 1 1
4 3
3 2
1 1 1
5 3
3 2
1 1 1
4 4
3 2
1 1 1
5 4
3 2
1 1 1
5 5
3 2
1 1 2
1 1
3 2
2 1 1
2 1
3 2
2 1 1
1 3
3 2
1 2 1
1 4
3 2
1 1 2
5 1
3 2
1 1 2
2 2
3 ...

output:

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
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
YES
YES
YES
NO
NO
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
NO
NO
NO
NO
YES
YES
YE...

result:

ok 525 token(s): yes count is 317, no count is 208

Test #8:

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

input:

3136
3 3
1 1 1
1 1 1
3 3
1 1 1
2 1 1
3 3
1 1 1
3 1 1
3 3
1 1 1
1 1 4
3 3
1 1 1
5 1 1
3 3
1 1 1
1 1 6
3 3
1 1 1
2 1 2
3 3
1 1 1
2 1 3
3 3
1 1 1
1 4 2
3 3
1 1 1
2 5 1
3 3
1 1 1
1 6 2
3 3
1 1 1
3 3 1
3 3
1 1 1
4 1 3
3 3
1 1 1
1 5 3
3 3
1 1 1
1 3 6
3 3
1 1 1
4 1 4
3 3
1 1 1
4 1 5
3 3
1 1 1
4 1 6
3 3
1 1...

output:

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

result:

ok 3136 token(s): yes count is 1458, no count is 1678

Test #9:

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

input:

17640
3 4
1 1 1
1 1 1 1
3 4
1 1 1
2 1 1 1
3 4
1 1 1
1 1 1 3
3 4
1 1 1
1 1 1 4
3 4
1 1 1
5 1 1 1
3 4
1 1 1
1 6 1 1
3 4
1 1 1
7 1 1 1
3 4
1 1 1
1 1 2 2
3 4
1 1 1
1 2 3 1
3 4
1 1 1
1 4 1 2
3 4
1 1 1
5 1 2 1
3 4
1 1 1
2 1 1 6
3 4
1 1 1
7 1 1 2
3 4
1 1 1
3 3 1 1
3 4
1 1 1
4 1 3 1
3 4
1 1 1
1 1 3 5
3 4
1 ...

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
NO
NO
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
YES
YES
YES
NO
NO
YES
YES
YES
YES
YES
YES
YES
YES
NO
NO
YES
YES
NO
N...

result:

ok 17640 token(s): yes count is 6647, no count is 10993

Test #10:

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

input:

17640
4 3
1 1 1 1
1 1 1
4 3
1 1 1 1
1 2 1
4 3
1 1 1 1
3 1 1
4 3
1 1 1 1
1 1 4
4 3
1 1 1 1
1 5 1
4 3
1 1 1 1
6 1 1
4 3
1 1 1 1
1 1 7
4 3
1 1 1 1
1 2 2
4 3
1 1 1 1
3 1 2
4 3
1 1 1 1
2 4 1
4 3
1 1 1 1
1 2 5
4 3
1 1 1 1
1 2 6
4 3
1 1 1 1
7 2 1
4 3
1 1 1 1
1 3 3
4 3
1 1 1 1
4 1 3
4 3
1 1 1 1
5 3 1
4 3
1 ...

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
NO
NO
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
YES
YES
YES
NO
NO
YES
YES
YES
YES
YES
YES
YES
YES
NO
NO
YES
YES
NO
N...

result:

ok 17640 token(s): yes count is 8926, no count is 8714

Test #11:

score: 0
Accepted
time: 33ms
memory: 9872kb

input:

95040
3 5
1 1 1
1 1 1 1 1
3 5
1 1 1
2 1 1 1 1
3 5
1 1 1
1 3 1 1 1
3 5
1 1 1
1 1 4 1 1
3 5
1 1 1
1 5 1 1 1
3 5
1 1 1
1 1 6 1 1
3 5
1 1 1
7 1 1 1 1
3 5
1 1 1
1 1 1 8 1
3 5
1 1 1
2 1 2 1 1
3 5
1 1 1
1 1 2 1 3
3 5
1 1 1
1 4 2 1 1
3 5
1 1 1
2 5 1 1 1
3 5
1 1 1
6 1 2 1 1
3 5
1 1 1
1 7 2 1 1
3 5
1 1 1
1 8 ...

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

result:

ok 95040 token(s): yes count is 29907, no count is 65133

Test #12:

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

input:

95040
5 3
1 1 1 1 1
1 1 1
5 3
1 1 1 1 1
2 1 1
5 3
1 1 1 1 1
3 1 1
5 3
1 1 1 1 1
4 1 1
5 3
1 1 1 1 1
5 1 1
5 3
1 1 1 1 1
1 6 1
5 3
1 1 1 1 1
1 1 7
5 3
1 1 1 1 1
1 8 1
5 3
1 1 1 1 1
1 2 2
5 3
1 1 1 1 1
1 3 2
5 3
1 1 1 1 1
4 1 2
5 3
1 1 1 1 1
2 5 1
5 3
1 1 1 1 1
6 1 2
5 3
1 1 1 1 1
1 7 2
5 3
1 1 1 1 1
...

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

result:

ok 95040 token(s): yes count is 50357, no count is 44683

Test #13:

score: 0
Accepted
time: 38ms
memory: 9748kb

input:

108900
4 4
1 1 1 1
1 1 1 1
4 4
1 1 1 1
1 1 2 1
4 4
1 1 1 1
3 1 1 1
4 4
1 1 1 1
1 1 4 1
4 4
1 1 1 1
1 5 1 1
4 4
1 1 1 1
1 1 6 1
4 4
1 1 1 1
7 1 1 1
4 4
1 1 1 1
1 1 8 1
4 4
1 1 1 1
1 2 1 2
4 4
1 1 1 1
3 1 2 1
4 4
1 1 1 1
2 1 4 1
4 4
1 1 1 1
1 2 5 1
4 4
1 1 1 1
1 2 6 1
4 4
1 1 1 1
7 1 2 1
4 4
1 1 1 1
1...

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

result:

ok 108900 token(s): yes count is 46206, no count is 62694

Test #14:

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

input:

50000
10 10
20 6 5 16 10 3 1 17 12 8
20 6 4 17 9 2 2 17 13 8
10 10
17 14 15 4 13 18 3 16 2 11
17 14 14 6 12 17 2 16 2 13
10 10
2 20 12 3 7 17 18 19 8 5
1 20 12 4 6 16 18 19 9 6
10 10
2 11 19 14 1 16 6 4 7 5
2 12 19 13 2 16 5 3 8 5
10 10
17 1 13 14 5 11 8 20 15 18
17 3 12 14 4 11 9 21 14 17
10 10
14 ...

output:

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

result:

ok 50000 token(s): yes count is 19646, no count is 30354

Test #15:

score: 0
Accepted
time: 50ms
memory: 9768kb

input:

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

output:

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

result:

ok 33333 token(s): yes count is 11692, no count is 21641

Test #16:

score: 0
Accepted
time: 42ms
memory: 9808kb

input:

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

output:

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

result:

ok 33333 token(s): yes count is 13098, no count is 20235

Test #17:

score: 0
Accepted
time: 67ms
memory: 9816kb

input:

5000
100 100
133 5 137 121 30 141 27 123 178 128 171 21 67 74 175 47 26 82 125 48 65 102 106 89 179 43 60 164 136 46 9 159 111 144 59 198 157 93 28 169 12 186 42 29 183 87 56 8 139 22 154 161 109 101 168 130 17 182 103 147 132 33 129 158 23 195 53 35 138 185 51 114 126 10 57 7 62 99 55 191 176 199 1...

output:

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

result:

ok 5000 token(s): yes count is 1091, no count is 3909

Test #18:

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

input:

500
1000 1000
410 461 57 202 1577 1597 994 944 1488 956 379 380 1486 1780 1244 1921 1794 265 1563 1679 243 65 1079 192 1839 762 1014 206 23 193 1185 1746 822 948 1397 1854 917 645 623 1726 809 1708 1765 1908 761 527 1603 1073 758 46 1592 203 1871 1873 1252 438 808 416 1128 1099 1107 735 151 1959 171...

output:

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

result:

ok 500 token(s): yes count is 70, no count is 430

Test #19:

score: 0
Accepted
time: 113ms
memory: 13980kb

input:

5
100000 100000
192348 43709 194484 134138 36415 165204 147428 196982 14278 195617 146117 168812 110270 1094 192657 135027 9041 181689 170958 162867 32338 18546 107477 98466 52702 82906 28257 89818 72376 34525 22246 170527 118863 160364 47995 153027 163962 98710 132547 38225 198231 78342 115823 4907...

output:

NO
NO
NO
NO
NO

result:

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

Test #20:

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

input:

1
500000 500000
298323 92801 517022 733075 950589 442461 98931 873034 365485 969370 407317 138461 421780 932696 964828 249894 562117 873629 795988 841659 25700 657972 879460 790648 337233 96409 76314 442433 323234 93538 461415 502833 763238 606519 203793 398485 683063 957433 104205 604635 952026 185...

output:

NO

result:

ok NO

Test #21:

score: 0
Accepted
time: 50ms
memory: 9804kb

input:

50000
10 10
12 14 6 7 8 18 9 20 23 2
12 14 6 7 8 18 9 20 23 2
10 10
18 5 10 16 8 7 17 15 2 1
18 5 10 16 8 7 17 15 2 1
10 10
6 10 3 18 19 21 7 15 9 17
6 10 3 18 19 21 7 15 9 17
10 10
6 11 9 20 1 13 2 16 17 4
6 11 9 20 1 13 2 16 17 4
10 10
15 9 14 2 10 22 12 11 23 1
15 9 14 2 10 22 12 11 23 1
10 10
14...

output:

NO
YES
NO
YES
NO
NO
YES
YES
NO
NO
NO
NO
YES
NO
NO
NO
NO
NO
NO
NO
NO
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
YES
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
YES
YES
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
YES
YES
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
N...

result:

ok 50000 token(s): yes count is 5971, no count is 44029

Test #22:

score: 0
Accepted
time: 48ms
memory: 9812kb

input:

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

output:

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

result:

ok 33333 token(s): yes count is 2998, no count is 30335

Test #23:

score: 0
Accepted
time: 48ms
memory: 9868kb

input:

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

output:

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

result:

ok 33333 token(s): yes count is 4670, no count is 28663

Test #24:

score: 0
Accepted
time: 62ms
memory: 9740kb

input:

5000
100 100
146 117 67 141 42 108 16 118 155 163 81 44 210 150 7 41 137 1 194 162 3 123 110 157 185 176 78 29 18 87 183 15 55 199 189 52 45 131 105 112 6 154 124 143 159 192 158 164 160 57 120 5 32 207 167 24 33 138 39 103 139 106 115 37 66 4 174 172 95 132 21 30 75 208 126 111 86 64 2 190 8 119 49...

output:

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

result:

ok 5000 token(s): yes count is 69, no count is 4931

Test #25:

score: 0
Accepted
time: 74ms
memory: 9756kb

input:

500
1000 1000
304 1098 1190 308 1439 1576 1127 1618 1697 1859 539 879 1361 1989 184 1645 1324 1172 695 476 936 133 437 479 1670 1852 1327 50 1402 259 958 1101 1057 1148 1865 316 26 1363 1933 1486 188 1513 434 109 1095 669 478 256 1976 842 932 127 652 261 1158 250 1906 1654 712 1907 46 86 1969 291 16...

output:

NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
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 500 token(s): yes count is 0, no count is 500

Test #26:

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

input:

500
1000 1000
1338 1948 2347 2143 2632 740 1681 2113 304 1765 634 2862 1855 1467 1589 2805 414 246 288 2896 630 1340 493 2980 1852 2926 1380 472 1648 1778 10 2763 1257 2089 2960 1270 2498 1592 657 8 2263 1562 2573 2088 1314 1793 1842 1226 1586 436 1780 2217 1598 336 1274 1639 1457 2799 245 2175 350 ...

output:

NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
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 500 token(s): yes count is 0, no count is 500

Test #27:

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

input:

5
100000 100000
175884 69085 200780 163097 174782 176860 177635 108439 58331 201693 45443 69964 67629 51542 230151 107451 248468 57 186555 154640 152853 186240 135695 65587 169123 140867 135857 34026 170860 122007 115654 152583 215432 194107 13818 172316 190315 104947 188587 138904 228578 106436 170...

output:

NO
NO
NO
NO
NO

result:

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

Test #28:

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

input:

5
100000 100000
664173 769141 1166 421665 157281 469088 467744 347428 125383 437372 170344 193734 178373 196363 532625 552680 59286 602040 621936 226773 333095 417999 564272 587755 178960 506514 402308 783593 180747 706116 285043 195160 214919 82095 148311 473751 189806 114149 798307 261957 232368 2...

output:

NO
NO
NO
NO
NO

result:

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

Test #29:

score: 0
Accepted
time: 110ms
memory: 28396kb

input:

1
500000 500000
897353 54134 40691 951584 976264 1025905 347917 284873 732288 588924 133252 567712 1015728 838624 494019 976920 723742 956033 571446 728126 129344 1060046 20061 258469 792326 765380 362099 832962 588916 305636 156212 843017 304793 1031490 746460 93058 760791 45824 309328 820232 94416...

output:

NO

result:

ok NO

Test #30:

score: 0
Accepted
time: 73ms
memory: 9868kb

input:

500000
1 1
2
2
1 1
4
5
1 1
5
2
1 1
5
5
1 1
4
4
1 1
1
4
1 1
3
6
1 1
2
3
1 1
4
2
1 1
2
5
1 1
5
3
1 1
2
4
1 1
1
6
1 1
3
5
1 1
5
4
1 1
2
4
1 1
5
5
1 1
6
4
1 1
4
5
1 1
5
4
1 1
2
1
1 1
4
2
1 1
5
1
1 1
6
5
1 1
4
5
1 1
5
2
1 1
2
5
1 1
2
1
1 1
5
1
1 1
3
5
1 1
2
2
1 1
1
4
1 1
4
5
1 1
2
3
1 1
6
3
1 1
6
3
1 1
2...

output:

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

result:

ok 500000 token(s): yes count is 97305, no count is 402695

Test #31:

score: -100
Runtime Error

input:

1
500000 500000
999999095 999999127 999999643 999999831 999999963 999999998 999999405 999999674 999999861 999999860 999999785 999999799 999999831 999999930 999999139 999999989 999999629 999999294 999999525 999999656 999999790 999999725 999999518 999999149 999999589 999999860 999999117 999999858 9999...

output:


result: