QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#807961#9799. Magical PalettewrkwrkAC ✓32ms3732kbC++237.2kb2024-12-10 15:10:342024-12-10 15:10:36

Judging History

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

  • [2024-12-10 15:10:36]
  • 评测
  • 测评结果:AC
  • 用时:32ms
  • 内存:3732kb
  • [2024-12-10 15:10:34]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
bool st;
namespace _wrk{;
template<int mod>
struct modint{
	int num;
	const static __uint128_t brt=((__uint128_t)(1)<<(64))/mod;
	modint(){
		num=0;
	}
	modint(int x){
		num=x%mod;
	}
	modint(long long x){
		num=x%mod;
	}
	modint<mod>operator=(int x){
		num=x%mod;
		return (*this);
	}
	modint<mod>operator=(long long x){
		num=x%mod;
		return (*this);
	}
	modint<mod>operator=(modint<mod>x){
		num=x.num;
		return (*this);
	}
	modint<mod> operator+(modint<mod> c)const{
		long long x=num+c.num;
		return x>=mod?x-mod:x;
	}
	modint<mod> operator-(modint<mod> c)const{
		long long x=num-c.num;
		return x<0?x+mod:x;
	}
	modint<mod>operator*(modint<mod>c)const{
		long long x=(long long)num*c.num;
		x=x-mod*(brt*x>>64);
		while(x>=mod)x-=mod;
		return x;
	}
	modint<mod>fpof(long long x)const{
		if(x<0)return inv().fpof(-x);
		if(x==0)return 1;
		auto c=((*this)*(*this)).fpof(x/2);
		if(x&1)return c*(*this);
		else return c;
	}
	struct modint_pow{
		int pf;
		modint_pow(int x){
			pf=x;
		}
		modint_pow(modint<mod> x){
			pf=x.num;
		}
		modint_pow operator+(modint_pow x){
			return pf+x.pf;
		}
	};
	modint_pow operator*(){
		return modint_pow(num);
	}
	modint<mod> operator*(modint_pow x){
		return (*this).fpof(x.pf);
	}
	modint<mod>inv()const{
		return fpof(mod-2);
	}
	modint<mod>operator/(modint<mod>c){
		return (*this)*c.inv();
	}
	operator int(){
		return num;
	}

	modint<mod>operator+=(modint<mod> c){
		return (*this)=(*this)+c;
	}
	modint<mod>operator-=(modint<mod> c){
		return (*this)=(*this)-c;
	}
	modint<mod>operator*=(modint<mod> c){
		return (*this)=(*this)*c;
	}
	modint<mod>operator/=(modint<mod> c){
		return (*this)=(*this)/c;
	}
	modint<mod>operator-(){
		return mod-num;
	}
	friend ostream& operator<<(ostream &w,modint<mod>&&x){
		w<<x.num;
		return w;
	}
	friend istream& operator>>(istream &w,modint<mod>&x){
		w>>x.num;
		x.num%=mod;
		return w;

	}
	bool operator==(modint<mod>x){
		return num==x.num;
	}

};

template<int mod,class type>
modint<mod>operator+(type a,modint<mod>b){
	return modint<mod>(a)+b;
}
template<int mod,class type>
modint<mod>operator-(type a,modint<mod>b){
	return modint<mod>(a)-b;
}
template<int mod,class type>
modint<mod>operator*(type a,modint<mod>b){
	return modint<mod>(a)*b;
}
template<int mod,class type>
modint<mod>operator/(type a,modint<mod>b){
	return modint<mod>(a)/b;
}
#define int long long

template<class type,int N>
struct matrix{
	type a[N+2][N+2];
	int n;
	type* operator[](int pos){
		return a[pos];
	}
	matrix<type,N> operator*(matrix<type,N>b){
		matrix<type,N>ans;
		ans.n=n;
		for(int i=1;i<=n;i++){
			for(int j=1;j<=n;j++){
				for(int k=1;k<=n;k++){
					ans[i][j]+=a[i][k]*b[k][j];
				}
			}
		}
		return ans;
	}
};
template<class type>
type fp(type a,int b){
	if(b==0)return type();
	if(b==1)return a;
	type w=fp(a*a,b/2);
	if(b%2)return w*a;
	return w;
}
template<int N>
struct yw_int_array{
	struct three21bit{
		int a:21;
		int b:21;
		int c:21;
	}a[N/3+2];
	struct ref{
		three21bit& s;
		char type;
		operator int(){
			if(type==0)return s.a;
			if(type==1)return s.b;
			return s.c;
		}
		ref& operator=(int x){
			if(type==0)s.a=x;
			else if(type==1)s.b=x;
			else s.c=x;
			return (*this);
		}
	};
	ref operator[](int pos){
		char w=pos%3;
		return {a[pos/3],(char)w};
	}
};
template<class type,int N>
struct backup_array{
	type name[N+5];
	vector<vector<pair<int,int>>>cc;
	void new_array(){
		cc.push_back(vector<pair<int,int>>());
	}
	backup_array(){
		cc.resize(1);
	}
	struct x{
		int id;
		type* name;
		vector<vector<pair<int,int>>> &cc;
		operator type(){
			return name[id];
		}
		type operator=(type w){
			cc.back().push_back({id,name[id]});
			name[id]=w;
			return w;
		}
	};
	x operator[](int pos){
		return {pos,name,cc};
	}
	void backup(){
		reverse(cc.back().begin(),cc.back().end());
		for(auto &x:cc.back()){
			name[x.first]=x.second;
		}
		cc.pop_back();
	}
};
template<class type,int N>
struct Math{
	type jc[N+5],inv[N+5],invjc[N+5];
	Math(){
		jc[0]=jc[1]=inv[1]=invjc[1]=invjc[0]=1;
		for(int i=2;i<=N;i++){
			jc[i]=jc[i-1]*type(i);
		}
		invjc[N]=type(1)/jc[N];
		for(int i=N-1;i>=2;i--){
			invjc[i]=invjc[i+1]*type(i+1);
		}
		for(int i=1;i<=N;i++){
			inv[i]=invjc[i]*jc[i-1];
		}
	}
	type binom(int a,int b){
		return jc[a]*invjc[b]*invjc[a-b];
	}
	type catalan(int n){
		return binom(2*n,n)/type(n+1);
	}
};
template<class type,int num,int maxnum>
struct pows{
	type w[maxnum+5];
	pows(){
		w[0]=type(1);
		for(int i=1;i<=maxnum;i++)w[i]=w[i-1]*type(num);
	}
	type operator[](int pos){
		return w[pos];
	}
};
#ifdef use_seg_tree
template<class type,class laz_type,int len>
struct segment_tree{
	type a[len<<2];
	laz_type laz[len<<2];
	void pushup(int now){
		PUSHUP_VALUE
	}
	void pushdown(int now,int l,int r){
		PUSHDOWN_VALUE
	}
	void build(int now,int l,int r){
		if(l+1==r){
			FIRST_VALUE
			return;
		}
		LAZ_CLEAR
		int mid=(l+r)>>1;
		build(now<<1,l,mid);
		build(now<<1|1,mid,r);
		pushup(now);
	}
	void do1(int now,int l,int r,int L,int R,...){
		if(l+1!=r)pushdown(now,l,r);
		if(R<=l||r<=L)return;
		if(L<=l&&r<=R){
			FULL_BLOCK_VALUE
			return;
		}
		int mid=(l+r)>>1;
		do1(now<<1,l,mid,L,R,...);
		do1(now<<1|1,mid,r,L,R,...);
		pushup(now);
	}
	void do1_one(int now,int l,int r,int p,...){
		if(l+1!=r)pushdown(now,l,r);
		if(l+1==r){
			DO1_VALUE
			return;
		}
		int mid=(l+r)>>1;
		if(p<mid)do1_one(now<<1,l,mid,p,...);
		else do1_one(now<<1|1,mid,r,p,...);
		pushup(now);
	}
	type qu1(int now,int l,int r,int L,int R){
		if(l+1!=r)pushdown(now,l,r);
		if(R<=l||r<=L)return BASE_VALUE
		if(L<=l&&r<=R)return a[now];
		int mid=(l+r)>>1;
		return RETURN_VALVE qu1(now<<1,l,mid,L,R)+qu1(now<<1|1,mid,r,L,R);
	}
	type qu1_one(int now,int l,int r,int p){
		if(l+1!=r)pushdown(now,l,r);
		if(l+1==r)return a[now];
		int mid=(l+r)>>1;
		if(p<mid)return qu1_one(now<<1,l,mid,p);
		else return qu1_one(now<<1|1,mid,r,p);

	}
};
#endif
//#define mod 998244353
//#define mint modint<mod>
//pows<mint,2,10000007>tp;note the size
//Math<mint,1000006>math;
//vector<int>g[1000006]
int p(int a,int b,int mod){
	if(!b)return 1%mod;
	int x=p(a*a%mod,b/2,mod);
	if(b&1)return x*a%mod;
	return x;
}
int phi(int x){
	int res=1;
	for(int i=2;i*i<=x;i++){
		if(x%i==0){
			x/=i;
			res*=i-1;
			while(x%i==0){
				res*=i;
				x/=i;
			}
		}
	}
	if(x!=1)res*=x-1;
	return res;
}
signed main(){
	ios::sync_with_stdio(false);
	cin.tie(0);cout.tie(0);
	int t;
	cin>>t;
	while(t--){
		
		int n,m;
		cin>>n>>m;
		if(__gcd(n,m)!=1){
			cout<<"No\n";
			continue;
		}
		//%n=i %m=1
		//%n=1 %m=i
		//kn+i -1= km
		int f=p(n,phi(m)-1,n*m),g=p(m,phi(n)-1,n*m); 
		cout<<"Yes\n";
		for(int i=0;i<n;i++){
			cout<<(g*i+1)%(n*m)<<' ';
		}
		cout<<'\n';
		for(int i=0;i<m;i++){
			cout<<(f*i+1)%(n*m)<<' ';
		}
		cout<<'\n';
	}
	return 0;
}
}
bool en;
signed main(){
	#ifdef LOCAL_WRK
	cerr<<"[Static Memory : "<<fixed<<((&st)-(&en))/1048576.0<<"MB]"<<endl;
	#endif
	   return _wrk::main();
}





这程序好像有点Bug,我给组数据试试?

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

2
2 3
2 2

output:

Yes
1 2 
1 3 5 
No

result:

ok 2 cases (2 test cases)

Test #2:

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

input:

1
1 1000000

output:

Yes
1 
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 1...

result:

ok 1 cases (1 test case)

Test #3:

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

input:

1
1000000 1

output:

Yes
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 ...

result:

ok 1 cases (1 test case)

Test #4:

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

input:

1
2 500000

output:

No

result:

ok 1 cases (1 test case)

Test #5:

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

input:

1
2 499999

output:

Yes
1 2 
1 250001 500001 750001 3 250003 500003 750003 5 250005 500005 750005 7 250007 500007 750007 9 250009 500009 750009 11 250011 500011 750011 13 250013 500013 750013 15 250015 500015 750015 17 250017 500017 750017 19 250019 500019 750019 21 250021 500021 750021 23 250023 500023 750023 25 25002...

result:

ok 1 cases (1 test case)

Test #6:

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

input:

1
500000 2

output:

No

result:

ok 1 cases (1 test case)

Test #7:

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

input:

1
499999 2

output:

Yes
1 250001 500001 750001 3 250003 500003 750003 5 250005 500005 750005 7 250007 500007 750007 9 250009 500009 750009 11 250011 500011 750011 13 250013 500013 750013 15 250015 500015 750015 17 250017 500017 750017 19 250019 500019 750019 21 250021 500021 750021 23 250023 500023 750023 25 250025 500...

result:

ok 1 cases (1 test case)

Test #8:

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

input:

1
3 333333

output:

No

result:

ok 1 cases (1 test case)

Test #9:

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

input:

1
3 333332

output:

Yes
1 333333 666665 
1 111112 222223 333334 444445 555556 666667 777778 888889 4 111115 222226 333337 444448 555559 666670 777781 888892 7 111118 222229 333340 444451 555562 666673 777784 888895 10 111121 222232 333343 444454 555565 666676 777787 888898 13 111124 222235 333346 444457 555568 666679 7...

result:

ok 1 cases (1 test case)

Test #10:

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

input:

1
333333 3

output:

No

result:

ok 1 cases (1 test case)

Test #11:

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

input:

1
333332 3

output:

Yes
1 111112 222223 333334 444445 555556 666667 777778 888889 4 111115 222226 333337 444448 555559 666670 777781 888892 7 111118 222229 333340 444451 555562 666673 777784 888895 10 111121 222232 333343 444454 555565 666676 777787 888898 13 111124 222235 333346 444457 555568 666679 777790 888901 16 1...

result:

ok 1 cases (1 test case)

Test #12:

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

input:

1
4 249999

output:

Yes
1 250000 499999 749998 
1 62501 125001 187501 250001 312501 375001 437501 500001 562501 625001 687501 750001 812501 875001 937501 5 62505 125005 187505 250005 312505 375005 437505 500005 562505 625005 687505 750005 812505 875005 937505 9 62509 125009 187509 250009 312509 375009 437509 500009 562...

result:

ok 1 cases (1 test case)

Test #13:

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

input:

1
249998 4

output:

No

result:

ok 1 cases (1 test case)

Test #14:

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

input:

1
14925 67

output:

Yes
1 243479 486957 730435 973913 217416 460894 704372 947850 191353 434831 678309 921787 165290 408768 652246 895724 139227 382705 626183 869661 113164 356642 600120 843598 87101 330579 574057 817535 61038 304516 547994 791472 34975 278453 521931 765409 8912 252390 495868 739346 982824 226327 46980...

result:

ok 1 cases (1 test case)

Test #15:

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

input:

1
1526 655

output:

Yes
1 429026 858051 287546 716571 146066 575091 4586 433611 862636 292131 721156 150651 579676 9171 438196 867221 296716 725741 155236 584261 13756 442781 871806 301301 730326 159821 588846 18341 447366 876391 305886 734911 164406 593431 22926 451951 880976 310471 739496 168991 598016 27511 456536 8...

result:

ok 1 cases (1 test case)

Test #16:

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

input:

1
24046 41

output:

Yes
1 217588 435175 652762 870349 102050 319637 537224 754811 972398 204099 421686 639273 856860 88561 306148 523735 741322 958909 190610 408197 625784 843371 75072 292659 510246 727833 945420 177121 394708 612295 829882 61583 279170 496757 714344 931931 163632 381219 598806 816393 48094 265681 4832...

result:

ok 1 cases (1 test case)

Test #17:

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

input:

1
12537 79

output:

Yes
1 648275 306126 954400 612251 270102 918376 576227 234078 882352 540203 198054 846328 504179 162030 810304 468155 126006 774280 432131 89982 738256 396107 53958 702232 360083 17934 666208 324059 972333 630184 288035 936309 594160 252011 900285 558136 215987 864261 522112 179963 828237 486088 143...

result:

ok 1 cases (1 test case)

Test #18:

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

input:

1
6367 157

output:

Yes
1 480892 961783 443055 923946 405218 886109 367381 848272 329544 810435 291707 772598 253870 734761 216033 696924 178196 659087 140359 621250 102522 583413 64685 545576 26848 507739 988630 469902 950793 432065 912956 394228 875119 356391 837282 318554 799445 280717 761608 242880 723771 205043 68...

result:

ok 1 cases (1 test case)

Test #19:

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

input:

1
1080 925

output:

No

result:

ok 1 cases (1 test case)

Test #20:

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

input:

1
36756 27

output:

No

result:

ok 1 cases (1 test case)

Test #21:

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

input:

1
23110 43

output:

Yes
1 397708 795415 199392 597099 1076 398783 796490 200467 598174 2151 399858 797565 201542 599249 3226 400933 798640 202617 600324 4301 402008 799715 203692 601399 5376 403083 800790 204767 602474 6451 404158 801865 205842 603549 7526 405233 802940 206917 604624 8601 406308 804015 207992 605699 96...

result:

ok 1 cases (1 test case)

Test #22:

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

input:

1
39072 25

output:

Yes
1 925226 873651 822076 770501 718926 667351 615776 564201 512626 461051 409476 357901 306326 254751 203176 151601 100026 48451 973676 922101 870526 818951 767376 715801 664226 612651 561076 509501 457926 406351 354776 303201 251626 200051 148476 96901 45326 970551 918976 867401 815826 764251 712...

result:

ok 1 cases (1 test case)

Test #23:

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

input:

1
38721 25

output:

Yes
1 300476 600951 901426 233876 534351 834826 167276 467751 768226 100676 401151 701626 34076 334551 635026 935501 267951 568426 868901 201351 501826 802301 134751 435226 735701 68151 368626 669101 1551 302026 602501 902976 235426 535901 836376 168826 469301 769776 102226 402701 703176 35626 33610...

result:

ok 1 cases (1 test case)

Test #24:

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

input:

10000
6 8
54 1
4 19
77 1
1 66
16 4
6 4
49 1
10 1
16 5
2 14
1 84
2 22
8 6
85 1
4 13
94 1
5 7
5 3
9 6
6 2
8 12
8 3
5 17
1 60
11 7
5 8
2 48
7 5
10 5
13 6
1 60
1 69
23 2
3 4
1 20
2 17
1 71
26 1
28 1
81 1
2 1
14 2
14 6
21 1
5 4
24 2
19 4
2 34
7 13
2 26
10 2
50 2
4 5
11 9
45 1
7 10
4 9
43 2
85 1
20 2
1 25...

output:

No
Yes
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 0 
1 
Yes
1 20 39 58 
1 25 49 73 21 45 69 17 41 65 13 37 61 9 33 57 5 29 53 
Yes
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24...

result:

ok 10000 cases (10000 test cases)

Test #25:

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

input:

5000
30 4
8 17
23 5
9 12
37 5
32 5
1 163
12 14
25 4
1 179
65 3
139 1
15 11
4 27
8 20
6 22
24 6
1 109
102 1
4 34
4 42
7 17
9 18
189 1
9 12
13 8
184 1
1 149
11 13
98 2
44 4
197 1
1 137
1 144
21 9
2 59
1 103
74 2
1 175
37 4
31 4
5 36
131 1
1 134
14 12
1 154
31 5
56 3
3 39
5 20
4 33
129 1
15 8
10 11
1 1...

output:

No
Yes
1 18 35 52 69 86 103 120 
1 33 65 97 129 25 57 89 121 17 49 81 113 9 41 73 105 
Yes
1 61 6 66 11 71 16 76 21 81 26 86 31 91 36 96 41 101 46 106 51 111 56 
1 93 70 47 24 
No
Yes
1 16 31 46 61 76 91 106 121 136 151 166 181 11 26 41 56 71 86 101 116 131 146 161 176 6 21 36 51 66 81 96 111 126 14...

result:

ok 5000 cases (5000 test cases)

Test #26:

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

input:

2000
9 52
26 18
7 64
21 10
6 81
6 52
87 5
5 70
55 6
279 1
404 1
58 5
263 1
29 14
296 1
10 45
200 2
204 2
5 84
20 19
2 137
3 160
54 6
78 6
44 5
206 2
17 17
12 26
46 6
299 1
6 76
6 77
214 2
1 468
2 161
497 1
29 13
18 25
80 3
4 114
93 3
458 1
31 8
34 6
1 307
111 3
412 1
72 4
246 1
2 209
20 19
496 1
220...

output:

Yes
1 365 261 157 53 417 313 209 105 
1 82 163 244 325 406 19 100 181 262 343 424 37 118 199 280 361 442 55 136 217 298 379 460 73 154 235 316 397 10 91 172 253 334 415 28 109 190 271 352 433 46 127 208 289 370 451 64 145 226 307 388 
No
Yes
1 65 129 193 257 321 385 
1 120 239 358 29 148 267 386 57 ...

result:

ok 2000 cases (2000 test cases)

Test #27:

score: 0
Accepted
time: 9ms
memory: 3728kb

input:

1000
1 654
229 4
55 11
49 14
1 711
6 159
16 42
191 5
4 242
276 2
73 8
6 109
1 527
1 781
1 996
20 43
550 1
304 3
1 595
69 8
1 674
146 4
257 2
88 6
2 378
1 906
116 7
542 1
1 552
41 23
294 2
10 87
297 3
251 3
951 1
128 5
49 17
6 165
587 1
37 21
175 3
157 5
155 4
1 505
545 1
57 12
25 20
1 632
35 22
5 11...

output:

Yes
1 
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 1...

result:

ok 1000 cases (1000 test cases)

Test #28:

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

input:

500
68 15
6 225
186 10
696 2
100 15
89 19
14 125
14 111
2 527
4 305
52 32
1875 1
3 359
6 251
93 17
351 4
9 169
242 5
18 108
206 8
196 7
1 1783
4 429
1953 1
308 6
1 1960
39 46
267 4
26 76
475 3
739 2
215 6
361 4
243 6
4 369
136 12
540 3
6 242
10 122
732 2
4 331
2 761
8 240
29 45
5 317
21 91
1 1220
36...

output:

Yes
1 196 391 586 781 976 151 346 541 736 931 106 301 496 691 886 61 256 451 646 841 16 211 406 601 796 991 166 361 556 751 946 121 316 511 706 901 76 271 466 661 856 31 226 421 616 811 1006 181 376 571 766 961 136 331 526 721 916 91 286 481 676 871 46 241 436 631 826 
1 273 545 817 69 341 613 885 1...

result:

ok 500 cases (500 test cases)

Test #29:

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

input:

200
600 4
8 546
4 696
73 36
605 8
33 98
11 250
170 13
4874 1
4929 1
82 26
1493 3
61 71
14 355
1 4259
70 69
3 1534
1 4067
4 1145
11 197
351 9
1 2801
36 56
6 737
5 493
3068 1
1 3422
9 385
20 112
182 23
507 9
59 55
24 203
21 143
754 5
67 73
161 26
2481 2
95 46
1038 3
1 3743
1248 2
2001 1
293 13
64 36
3...

output:

No
No
No
Yes
1 145 289 433 577 721 865 1009 1153 1297 1441 1585 1729 1873 2017 2161 2305 2449 2593 109 253 397 541 685 829 973 1117 1261 1405 1549 1693 1837 1981 2125 2269 2413 2557 73 217 361 505 649 793 937 1081 1225 1369 1513 1657 1801 1945 2089 2233 2377 2521 37 181 325 469 613 757 901 1045 1189...

result:

ok 200 cases (200 test cases)

Test #30:

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

input:

100
90 71
67 118
2 4452
5 1081
2678 2
558 11
1 8976
26 195
120 54
184 40
4 1454
1236 8
2 3819
7894 1
164 48
340 21
243 33
3 3186
2 3118
35 246
2564 3
110 48
1 7316
11 711
1 9851
299 33
6692 1
1 7204
2919 2
302 23
990 9
80 64
39 222
1 9235
8 657
6617 1
781 10
3 2269
83 63
82 116
181 36
160 43
41 227
...

output:

Yes
1 72 143 214 285 356 427 498 569 640 711 782 853 924 995 1066 1137 1208 1279 1350 1421 1492 1563 1634 1705 1776 1847 1918 1989 2060 2131 2202 2273 2344 2415 2486 2557 2628 2699 2770 2841 2912 2983 3054 3125 3196 3267 3338 3409 3480 3551 3622 3693 3764 3835 3906 3977 4048 4119 4190 4261 4332 4403...

result:

ok 100 cases (100 test cases)

Test #31:

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

input:

50
68 185
1 11708
1 15415
50 323
16127 1
1 13310
1 12735
29 463
2846 4
107 142
1021 18
13 850
11192 1
11737 1
21 855
143 76
6 2224
81 209
958 14
2181 6
2 6770
51 387
3713 4
442 38
1 19201
63 246
367 34
11 1452
12 1536
7416 2
12 1196
1 19544
2 6529
1584 7
1049 12
17496 1
150 93
4 3597
601 17
616 21
8...

output:

Yes
1 2406 4811 7216 9621 12026 1851 4256 6661 9066 11471 1296 3701 6106 8511 10916 741 3146 5551 7956 10361 186 2591 4996 7401 9806 12211 2036 4441 6846 9251 11656 1481 3886 6291 8696 11101 926 3331 5736 8141 10546 371 2776 5181 7586 9991 12396 2221 4626 7031 9436 11841 1666 4071 6476 8881 11286 11...

result:

ok 50 cases (50 test cases)

Test #32:

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

input:

20
1 26703
10447 2
3428 11
1 30557
25506 1
3 14045
23 1241
1 38121
47929 1
6 6525
10 3843
2 18497
349 80
9 3452
5265 6
6050 8
26677 1
497 60
742 36
45384 1

output:

Yes
1 
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 1...

result:

ok 20 cases (20 test cases)

Test #33:

score: 0
Accepted
time: 5ms
memory: 3732kb

input:

10
1318 38
86190 1
89 756
14065 6
505 188
8 12423
2114 30
123 637
1303 70
4099 18

output:

No
Yes
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 1...

result:

ok 10 cases (10 test cases)

Test #34:

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

input:

5
4 26499
11 13627
12 15726
146988 1
71136 2

output:

Yes
1 26500 52999 79498 
1 33125 66249 99373 26501 59625 92749 19877 53001 86125 13253 46377 79501 6629 39753 72877 5 33129 66253 99377 26505 59629 92753 19881 53005 86129 13257 46381 79505 6633 39757 72881 9 33133 66257 99381 26509 59633 92757 19885 53009 86133 13261 46385 79509 6637 39761 72885 13...

result:

ok 5 cases (5 test cases)

Test #35:

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

input:

400
16 26
37 8
17 17
45 14
32 30
46 28
32 22
41 6
35 9
24 35
24 18
47 32
47 49
50 33
40 39
47 3
24 13
29 49
15 20
3 6
50 18
1 27
47 23
14 49
22 40
39 41
46 23
11 44
34 45
16 13
43 16
13 13
12 28
24 29
23 23
20 1
26 42
33 19
23 26
12 10
27 19
13 23
15 26
27 35
44 21
12 37
15 44
49 11
38 28
24 7
48 21...

output:

No
Yes
1 89 177 265 57 145 233 25 113 201 289 81 169 257 49 137 225 17 105 193 281 73 161 249 41 129 217 9 97 185 273 65 153 241 33 121 209 
1 38 75 112 149 186 223 260 
No
Yes
1 435 239 43 477 281 85 519 323 127 561 365 169 603 407 211 15 449 253 57 491 295 99 533 337 141 575 379 183 617 421 225 29...

result:

ok 400 cases (400 test cases)

Test #36:

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

input:

100
67 92
91 65
59 66
99 60
86 56
81 55
54 57
66 85
92 83
56 70
78 72
63 60
99 74
91 51
93 67
67 65
78 66
95 69
76 75
65 71
70 99
97 81
89 80
69 61
53 93
92 52
76 87
80 96
56 90
51 56
62 55
81 83
66 71
79 92
82 73
64 94
52 77
53 87
85 51
96 94
75 68
63 72
53 63
86 75
100 65
79 93
100 74
78 65
88 85
...

output:

Yes
1 5889 5613 5337 5061 4785 4509 4233 3957 3681 3405 3129 2853 2577 2301 2025 1749 1473 1197 921 645 369 93 5981 5705 5429 5153 4877 4601 4325 4049 3773 3497 3221 2945 2669 2393 2117 1841 1565 1289 1013 737 461 185 6073 5797 5521 5245 4969 4693 4417 4141 3865 3589 3313 3037 2761 2485 2209 1933 16...

result:

ok 100 cases (100 test cases)

Test #37:

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

input:

25
137 170
169 165
151 194
101 111
122 162
166 170
182 123
127 148
164 103
148 127
103 199
148 155
105 130
150 115
181 118
172 188
108 130
177 195
156 196
159 170
101 116
171 143
192 127
181 157
101 167

output:

Yes
1 6631 13261 19891 3231 9861 16491 23121 6461 13091 19721 3061 9691 16321 22951 6291 12921 19551 2891 9521 16151 22781 6121 12751 19381 2721 9351 15981 22611 5951 12581 19211 2551 9181 15811 22441 5781 12411 19041 2381 9011 15641 22271 5611 12241 18871 2211 8841 15471 22101 5441 12071 18701 2041...

result:

ok 25 cases (25 test cases)

Test #38:

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

input:

4
418 473
417 226
341 382
413 375

output:

No
Yes
1 14465 28929 43393 57857 72321 86785 7007 21471 35935 50399 64863 79327 93791 14013 28477 42941 57405 71869 86333 6555 21019 35483 49947 64411 78875 93339 13561 28025 42489 56953 71417 85881 6103 20567 35031 49495 63959 78423 92887 13109 27573 42037 56501 70965 85429 5651 20115 34579 49043 6...

result:

ok 4 cases (4 test cases)

Test #39:

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

input:

1
564 698

output:

No

result:

ok 1 cases (1 test case)

Extra Test:

score: 0
Extra Test Passed