QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#607898#4758. Captivating processhysbzdkfWA 199ms5216kbC++14943b2024-10-03 16:57:412024-10-03 16:57:41

Judging History

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

  • [2024-10-03 16:57:41]
  • 评测
  • 测评结果:WA
  • 用时:199ms
  • 内存:5216kb
  • [2024-10-03 16:57:41]
  • 提交

answer

#include<bits/stdc++.h>
#define int long long
using namespace std;
int n,m,f[100001],g[100001];
map<int,map<int,bool> >mp;
bool flag;
signed main(){
//	freopen("35.in","r",stdin);
//	freopen("0.out","w",stdout);
	cin>>n>>m;
	for(int i=1;i<=n;i++)
		cin>>f[i];
	for(int i=1;i<=n;i++)
		cin>>g[i];
	for(int s,t,i=1;i<=m;i++){
		flag=0;
		mp.clear();
//		cout<<"____1_____"<<endl;
		cin>>s>>t;
		if(n>1000){
			if(s==t)
				cout<<"YES"<<endl;
			else
				cout<<"NO"<<endl;
			continue;
		}
//		cout<<"____2__________"<<endl;
		if(s==t){
			cout<<"YES"<<endl;
			continue;
		}
		while(!mp[s][t]){
//			cout<<s<<" "<<t<<endl;
			mp[s][t]=1;
			s=f[s];
			t=g[t];
			if(s==t){
				flag=1;
				break;
			}
		}
		if(flag)
			cout<<"YES"<<endl;
		else
			cout<<"NO"<<endl;
	}
	return 0;
}
/*
10 10
3 8 7 3 7 6 4 1 9 10
3 3 2 6 7 6 5 5 10 10
1 5
10 4
10 2
7 6
8 7
3 4
10 5
5 5
2 6
8 5
? 
*/

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

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

output:

NO
YES

result:

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

Test #2:

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

input:

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

output:

NO
YES

result:

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

Test #3:

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

input:

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

output:

NO
NO
YES
NO
YES
NO
YES
NO
NO
NO

result:

ok 10 token(s): yes count is 3, no count is 7

Test #4:

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

input:

10 10
5 7 8 2 6 8 7 5 5 10
8 2 5 8 3 9 10 7 2 8
8 7
5 6
4 9
3 6
5 6
2 3
8 4
5 9
6 8
3 4

output:

NO
NO
YES
NO
NO
NO
NO
NO
NO
YES

result:

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

Test #5:

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

input:

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

output:

NO
NO
NO
YES
NO
NO
NO
NO
NO
NO

result:

ok 10 token(s): yes count is 1, no count is 9

Test #6:

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

input:

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

output:

YES
NO
YES
YES
NO
YES
YES
YES
YES
YES

result:

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

Test #7:

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

input:

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

output:

YES
NO
YES
YES
YES
YES
NO
NO
NO
NO

result:

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

Test #8:

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

input:

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

output:

NO
YES
NO
YES
NO
NO
YES
NO
YES
YES

result:

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

Test #9:

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

input:

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

output:

NO
NO
NO
NO
YES
NO
YES
NO
NO
NO

result:

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

Test #10:

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

input:

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

output:

YES
YES
YES
YES
YES
YES
NO
YES
YES
YES

result:

ok 10 token(s): yes count is 9, no count is 1

Test #11:

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

input:

100 100
41 55 57 45 38 30 83 53 33 51 90 57 82 35 28 54 35 47 39 68 67 98 57 8 71 99 83 39 83 44 76 88 18 41 15 17 39 46 79 79 54 28 57 22 81 33 63 17 1 21 32 58 47 17 4 46 10 45 97 44 29 71 5 50 79 66 83 88 43 97 50 56 5 100 23 1 66 16 76 34 71 60 59 57 87 47 6 23 68 55 79 32 73 10 98 65 90 30 79 5...

output:

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

result:

ok 100 token(s): yes count is 35, no count is 65

Test #12:

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

input:

100 100
70 57 94 89 18 74 52 32 87 20 73 47 60 55 74 37 33 81 55 2 23 23 69 23 52 12 92 85 38 25 41 66 49 94 27 50 23 35 23 38 58 81 75 92 11 6 36 33 8 60 13 2 58 93 59 67 46 95 45 12 56 87 31 25 18 5 17 10 95 47 38 72 87 84 17 39 74 36 39 23 91 90 86 68 23 20 38 29 60 60 56 19 66 43 21 7 84 25 41 5...

output:

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

result:

ok 100 token(s): yes count is 28, no count is 72

Test #13:

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

input:

100 100
48 86 67 28 67 38 10 31 5 90 67 38 64 38 86 22 29 71 25 27 89 34 4 83 99 82 45 79 50 12 13 38 4 49 77 90 4 81 87 92 4 50 65 37 86 90 45 69 17 34 32 38 13 77 10 68 2 69 39 80 82 32 95 25 1 87 100 74 63 57 61 99 14 87 10 11 28 46 23 71 14 80 10 88 79 70 92 13 79 24 83 5 48 68 65 20 61 27 13 39...

output:

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

result:

ok 100 token(s): yes count is 16, no count is 84

Test #14:

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

input:

100 100
29 3 9 64 93 98 50 93 98 79 28 28 16 18 30 68 91 80 5 39 93 14 79 96 91 98 25 20 33 49 14 28 65 64 50 15 68 20 62 92 23 50 29 9 47 85 23 36 11 24 35 52 70 70 99 15 1 96 14 32 77 89 100 35 46 82 94 74 32 64 57 46 31 19 13 75 48 62 53 97 26 90 35 92 61 1 59 61 57 73 25 9 55 14 92 47 81 66 76 8...

output:

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

result:

ok 100 token(s): yes count is 74, no count is 26

Test #15:

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

input:

100 100
86 1 12 24 31 19 62 98 11 27 18 13 68 79 20 91 89 5 66 9 42 94 93 52 64 13 63 32 82 3 98 75 39 85 52 21 13 69 46 15 13 67 20 89 56 74 89 30 88 49 22 47 7 58 99 90 92 42 34 3 59 65 71 23 73 86 32 42 59 21 39 83 100 65 27 8 3 30 6 12 11 10 89 9 50 14 42 55 64 61 9 75 51 15 90 76 80 4 90 26
100...

output:

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

result:

ok 100 token(s): yes count is 77, no count is 23

Test #16:

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

input:

100 100
35 70 20 10 57 8 23 53 22 79 50 71 33 3 37 55 31 77 68 57 65 59 21 27 75 52 13 81 12 22 57 78 62 19 26 45 48 78 7 87 96 53 15 93 2 88 40 29 84 18 57 75 50 15 46 62 54 48 16 81 29 40 27 14 19 48 53 100 97 45 99 27 39 81 73 75 93 84 69 98 64 93 63 10 73 51 8 35 13 78 18 15 83 60 14 93 60 42 78...

output:

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

result:

ok 100 token(s): yes count is 67, no count is 33

Test #17:

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

input:

100 100
61 33 6 75 57 51 9 23 64 97 54 28 72 49 55 45 13 89 91 80 43 30 99 89 27 36 59 100 95 61 37 4 91 67 71 61 8 19 81 66 77 5 53 65 68 34 26 98 95 79 96 45 59 66 81 25 86 5 90 6 21 48 82 58 14 78 93 50 88 45 28 20 83 97 62 71 84 20 67 85 13 50 46 93 86 2 88 31 68 71 39 20 69 34 65 32 22 60 83 47...

output:

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

result:

ok 100 token(s): yes count is 37, no count is 63

Test #18:

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

input:

100 100
45 27 7 34 10 5 90 61 3 73 74 29 94 45 28 60 57 44 75 59 15 79 76 99 32 54 90 84 37 45 44 39 26 93 18 29 16 25 100 38 82 54 61 53 98 62 92 33 86 8 85 32 59 92 57 28 83 88 55 80 36 5 59 19 3 24 4 14 78 44 39 42 15 68 64 49 72 40 41 43 74 81 44 6 47 23 60 24 32 51 35 51 27 17 94 57 43 22 42 19...

output:

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

result:

ok 100 token(s): yes count is 32, no count is 68

Test #19:

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

input:

100 100
90 94 79 48 1 93 16 78 42 64 93 81 15 84 93 5 70 97 70 82 93 4 20 5 80 55 92 55 57 78 70 7 26 22 38 89 23 77 87 59 60 23 49 77 6 9 99 41 80 10 91 14 51 64 7 57 24 33 57 81 35 83 18 37 84 17 100 58 74 98 13 9 67 62 9 70 61 29 85 3 34 52 26 70 43 76 73 95 59 69 84 91 39 47 78 84 41 50 28 45
73...

output:

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

result:

ok 100 token(s): yes count is 37, no count is 63

Test #20:

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

input:

100 100
59 76 55 74 15 80 48 58 53 9 99 34 55 62 69 25 71 95 75 40 54 8 51 54 91 65 18 48 22 15 77 45 21 46 14 12 2 58 13 10 73 81 27 23 31 87 74 24 73 14 41 25 67 96 33 18 90 56 94 79 46 83 27 20 94 61 91 44 37 31 45 19 5 29 12 68 57 46 72 82 55 97 54 17 28 10 35 19 30 17 47 94 15 24 11 6 79 86 20 ...

output:

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

result:

ok 100 token(s): yes count is 69, no count is 31

Test #21:

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

input:

100 100
70 35 83 50 63 74 45 19 17 15 96 98 31 29 97 38 54 1 2 29 24 58 73 60 69 94 31 92 66 4 34 6 49 37 79 11 75 84 9 100 2 38 64 9 16 33 29 95 61 92 3 30 95 23 12 80 58 100 6 10 26 86 18 44 83 21 5 82 46 14 99 86 4 53 63 64 51 66 12 25 22 36 38 88 23 55 13 56 35 59 78 89 36 77 13 43 90 68 92 32
7...

output:

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

result:

ok 100 token(s): yes count is 63, no count is 37

Test #22:

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

input:

100 100
95 52 23 14 81 29 36 57 88 22 85 37 42 25 39 17 46 48 82 47 86 35 65 77 90 73 55 70 11 54 19 13 73 12 84 69 76 26 97 23 16 44 34 78 50 18 71 49 86 63 7 15 56 13 26 74 64 45 67 52 15 37 53 24 54 59 17 79 1 61 54 20 96 43 19 90 9 68 51 79 24 66 3 50 28 19 31 98 60 22 69 96 83 9 40 6 77 27 100 ...

output:

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

result:

ok 100 token(s): yes count is 71, no count is 29

Test #23:

score: 0
Accepted
time: 93ms
memory: 3796kb

input:

1000 1000
670 933 61 49 782 717 517 379 845 683 94 724 202 183 1000 595 95 713 375 852 160 833 669 743 29 854 169 608 980 787 760 622 999 214 380 13 835 183 553 372 529 775 521 401 881 845 584 257 714 612 929 654 548 911 295 458 318 550 55 834 222 306 975 672 827 224 153 237 821 851 89 476 246 830 6...

output:

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

result:

ok 1000 token(s): yes count is 578, no count is 422

Test #24:

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

input:

1000 1000
150 928 684 820 869 148 247 594 365 829 51 515 115 167 986 737 552 787 907 120 871 979 674 337 380 497 230 960 958 799 273 249 60 252 332 378 258 75 758 923 601 404 781 596 829 413 295 56 121 459 146 526 193 614 233 789 433 165 637 766 699 228 424 717 133 191 984 651 300 110 381 864 489 26...

output:

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

result:

ok 1000 token(s): yes count is 548, no count is 452

Test #25:

score: 0
Accepted
time: 78ms
memory: 3824kb

input:

1000 1000
978 931 774 425 608 663 641 298 902 827 376 785 723 259 169 224 872 236 631 716 172 997 730 954 809 479 267 659 61 371 99 821 442 806 651 577 93 671 719 503 516 280 326 506 246 925 352 789 575 547 968 660 523 668 978 880 952 668 471 833 786 200 833 449 159 630 765 290 257 261 712 416 151 2...

output:

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

result:

ok 1000 token(s): yes count is 534, no count is 466

Test #26:

score: 0
Accepted
time: 127ms
memory: 4000kb

input:

1000 1000
925 396 209 391 896 547 349 722 65 16 454 490 420 659 266 777 37 523 768 323 515 814 881 565 412 257 938 727 49 902 190 366 70 658 740 829 77 745 771 619 43 51 601 10 337 756 902 313 996 826 940 992 638 796 117 272 847 763 787 354 204 629 946 986 282 944 946 732 708 981 529 90 219 14 823 8...

output:

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

result:

ok 1000 token(s): yes count is 774, no count is 226

Test #27:

score: 0
Accepted
time: 125ms
memory: 4104kb

input:

1000 1000
305 848 938 412 350 817 26 564 132 234 683 744 120 533 630 145 73 960 666 123 713 346 681 303 239 285 533 976 727 857 188 215 327 934 62 948 527 201 818 771 659 890 59 955 191 542 273 611 282 299 280 64 873 393 99 359 646 108 581 435 628 715 161 644 51 631 884 197 653 320 94 488 134 48 615...

output:

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

result:

ok 1000 token(s): yes count is 747, no count is 253

Test #28:

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

input:

1000 1000
327 371 676 172 845 3 701 763 29 165 257 236 912 700 218 301 599 891 8 549 372 68 401 142 332 726 748 55 334 264 401 507 829 425 855 963 104 19 792 998 694 944 240 8 737 835 37 863 741 651 803 763 680 776 559 511 968 459 639 621 71 740 71 588 267 456 374 701 888 697 864 932 275 348 945 801...

output:

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

result:

ok 1000 token(s): yes count is 927, no count is 73

Test #29:

score: 0
Accepted
time: 120ms
memory: 3896kb

input:

1000 1000
82 441 995 519 77 611 193 139 677 391 468 126 21 453 781 288 346 731 574 632 615 783 424 85 990 640 773 144 284 757 158 125 19 316 839 990 80 705 686 451 952 258 542 877 773 767 876 752 130 927 837 927 577 360 231 296 320 543 417 481 544 916 307 2 599 85 236 328 509 935 974 531 858 486 21 ...

output:

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

result:

ok 1000 token(s): yes count is 754, no count is 246

Test #30:

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

input:

1000 1000
140 387 349 905 260 752 94 467 725 635 391 645 725 794 796 384 463 290 912 521 956 543 207 95 10 150 913 982 522 352 958 102 114 483 628 319 254 126 221 629 339 377 927 981 334 452 765 647 915 789 226 867 591 189 186 768 94 235 198 899 590 888 741 743 467 275 419 942 442 549 814 304 358 34...

output:

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

result:

ok 1000 token(s): yes count is 784, no count is 216

Test #31:

score: 0
Accepted
time: 63ms
memory: 3756kb

input:

1000 1000
473 786 818 334 938 322 702 82 710 67 460 855 831 350 496 201 255 602 263 841 677 271 981 308 402 826 751 678 588 693 660 722 497 74 11 962 808 232 283 492 750 756 287 835 252 733 551 69 877 884 109 471 644 257 461 577 446 729 308 971 415 26 249 116 904 819 921 247 847 131 647 449 616 993 ...

output:

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

result:

ok 1000 token(s): yes count is 472, no count is 528

Test #32:

score: 0
Accepted
time: 129ms
memory: 4008kb

input:

1000 1000
433 272 373 324 566 843 355 761 919 144 557 168 632 854 680 264 23 510 603 858 459 758 176 149 85 476 736 238 777 966 863 16 555 778 715 84 216 389 930 337 648 526 836 872 699 769 666 226 789 465 102 414 659 96 897 431 225 403 406 865 430 656 86 851 829 665 12 146 926 285 757 832 137 259 6...

output:

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

result:

ok 1000 token(s): yes count is 849, no count is 151

Test #33:

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

input:

1000 1000
607 449 297 708 974 50 831 844 266 190 170 900 406 784 714 352 599 917 211 891 45 578 629 988 495 336 65 361 926 736 411 817 778 520 763 622 58 653 272 987 263 124 181 954 315 516 872 493 354 460 687 90 644 768 989 880 399 738 429 13 790 889 397 268 133 611 362 742 244 304 120 152 42 351 2...

output:

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

result:

ok 1000 token(s): yes count is 871, no count is 129

Test #34:

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

input:

1000 1000
768 287 319 347 303 477 184 284 957 591 376 330 191 105 157 300 434 433 435 622 465 430 406 466 383 306 391 271 188 109 756 722 769 505 402 642 340 297 702 686 338 931 371 444 331 519 439 388 476 320 336 174 369 452 916 533 505 852 908 625 813 549 101 888 653 260 926 848 749 968 995 559 48...

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

result:

ok 1000 token(s): yes count is 912, no count is 88

Test #35:

score: -100
Wrong Answer
time: 79ms
memory: 5216kb

input:

100000 100000
63821 89740 88188 36317 60750 81601 65195 26021 53849 78215 40363 12575 41967 16413 1166 99946 24647 17518 86893 41539 1302 15450 3422 8704 26690 61125 95668 50258 35729 14488 39156 13282 72003 64776 24740 65571 31773 82979 22266 27872 10936 20958 83101 69596 52753 34309 79373 8834 984...

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:

wrong answer expected YES, found NO [5074th token]