QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#353986#8107. PermutationNaganohara_YoimiyaAC ✓86ms137088kbC++143.4kb2024-03-14 20:14:162024-03-14 20:14:17

Judging History

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

  • [2024-03-14 20:14:17]
  • 评测
  • 测评结果:AC
  • 用时:86ms
  • 内存:137088kb
  • [2024-03-14 20:14:16]
  • 提交

answer

#include<bits/stdc++.h>

#define ll long long
#define mk make_pair
#define fi first
#define se second
#define int long long

using namespace std;

inline ll read(){
	ll x=0,f=1;char c=getchar();
	for(;(c<'0'||c>'9');c=getchar()){if(c=='-')f=-1;}
	for(;(c>='0'&&c<='9');c=getchar())x=x*10+(c&15);
	return x*f;
}

template<typename T>void cmax(T &x,T v){x=max(x,v);}
template<typename T>void cmin(T &x,T v){x=min(x,v);}

int n;ll k;

namespace Solve1{

ll f[105][10005];
void solve(){
	int tar=n*(n-1)/4,cur=0;
	vector<int>vis(n+1);
	auto calc=[&](){
		int cnt=0,tot=0;
		for(int i=1;i<=n;i++){
			if(vis[i])tot+=cnt;
			else cnt++;
		}
		return tot;
	};
	
	f[0][0]=1;
	for(int i=1;i<=n;i++){
		for(int j=0;j<=i*(i-1)/2;j++){
			for(int x=0;x<=min(i-1,j);x++)f[i][j]=min(k+1,f[i][j]+f[i-1][j-x]);
		}
	}
	
	vector<int>ans(n+1);
	for(int i=1;i<=n;i++){
		for(int j=1;j<=n;j++)if(!vis[j]){
			int cnt=cur;
			for(int k=j+1;k<=n;k++)if(vis[k])cnt++;
			vis[j]=1,cnt+=calc();
			if(cnt>tar){
				vis[j]=0;continue;
			}
			ll ways=f[n-i][tar-cnt];
			if(ways<k){
				k-=ways,vis[j]=0;
				continue;
			}
			else{
				ans[i]=j;
				for(int k=j+1;k<=n;k++)if(vis[k])cur++;
				break;				
			}
		}
		if(ans[i]==0)return puts("NO"),void();
	}
	
	puts("YES");
	for(int i=1;i<=n;i++)cout<<ans[i]<<" \n"[i==n];
}

}

namespace Solve2{

const int N=3e5+5;
const int D=20;
ll f[N][D];
__int128 sum[N][D];

struct BIT{
	int c[N];
	int lowbit(int x){return x&(-x);}
	void add(int x,int v){for(int i=x;i<=n;i+=lowbit(i))c[i]+=v;}
	int qsum(int x){int res=0;for(int i=x;i;i-=lowbit(i))res+=c[i];return res;}
}T;

void solve(){
	f[0][0]=1;for(int j=0;j<D;j++)sum[0][j]=1;
	for(int i=1;i<=n;i++){
		for(int j=0;j<D;j++){
			if(j<=i-1)f[i][j]=min(sum[i-1][j],(__int128)(k)+1);
			else f[i][j]=min(sum[i-1][j]-sum[i-1][j-i],(__int128)(k)+1);
		}
		sum[i][0]=f[i][0];
		for(int j=1;j<D;j++)sum[i][j]=sum[i][j-1]+f[i][j];
	}
	
	auto getans=[&](int n,int tar,ll K){
		vector<int>ans(n+1);
		set<int>S;
		for(int i=1;i<=n;i++)S.insert(i);
		ll cur=0;
		for(int i=1;i<=n;i++){
			int L=1,R=n,lim=n;
			while(L<=R){
				int j=(L+R)>>1;
				if(cur+n-j-(i-1-T.qsum(j-1))>tar)L=j+1;
				else R=j-1,lim=j;
			}
			for(auto it=S.lower_bound(lim);it!=S.end();++it){
				int j=(*it);
				ll cnt=cur+n-j-(i-1-T.qsum(j-1));
				if(cnt>tar)continue;
				ll ways=f[n-i][tar-cnt];
				if(ways<K){K-=ways;continue;}
				else{
					ans[i]=j,cur=cnt,S.erase(S.find(j)),T.add(j,1);
					break;				
				}
			}
		}
		return ans;
	};
	
	auto hav=[&](int i){return 1ll*i*(i-1)/2+1ll*i*(n-i);};
	ll tar=1ll*n*(n-1)/4;int p=0;
	for(int i=1;i<=n;i++)if(hav(i)<=tar)p=i;
	
	vector<int>ans(n+1);
	for(int i=1;i<=p;i++)ans[i]=i;
	
	int ret=0;
	for(int i=0;i<D;i++){
		if(k<=f[n-p-1][i]){ret=i;break;}
		k-=f[n-p-1][i];
	}
	int cc=tar-hav(p);
	ans[p+1]=n-cc+ret;
	
	auto vec=getans(n-p-1,ret,k);
	vector<int>id(n+1),vis(n+1);
	for(int i=1;i<=p+1;i++)vis[ans[i]]=1;
	int cnt=0;
	for(int i=1;i<=n;i++){
		if(vis[i]==1)continue;
		id[++cnt]=i;
	}
	for(int i=1;i<=n-p-1;i++)ans[i+p+1]=id[vec[i]];
	
	puts("YES");
	for(int i=1;i<=n;i++)cout<<ans[i]<<" \n"[i==n];
}

}

signed main(void){

#ifndef ONLINE_JUDGE
	freopen("in.in","r",stdin);
#endif

	n=read(),k=read();
	if(n%4==2||n%4==3)return puts("NO"),0;
	if(n<=80)return Solve1::solve(),0;
	else return Solve2::solve(),0;

	return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

4 3

output:

YES
2 4 1 3

result:

ok 2 lines

Test #2:

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

input:

4 57

output:

NO

result:

ok single line: 'NO'

Test #3:

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

input:

1 1

output:

YES
1

result:

ok 2 lines

Test #4:

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

input:

1 2

output:

NO

result:

ok single line: 'NO'

Test #5:

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

input:

1 42

output:

NO

result:

ok single line: 'NO'

Test #6:

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

input:

4 1

output:

YES
1 4 3 2

result:

ok 2 lines

Test #7:

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

input:

4 6

output:

YES
4 1 2 3

result:

ok 2 lines

Test #8:

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

input:

4 7

output:

NO

result:

ok single line: 'NO'

Test #9:

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

input:

5 13

output:

YES
3 4 2 1 5

result:

ok 2 lines

Test #10:

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

input:

5 21

output:

YES
5 1 3 2 4

result:

ok 2 lines

Test #11:

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

input:

5 22

output:

YES
5 2 1 3 4

result:

ok 2 lines

Test #12:

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

input:

5 23

output:

NO

result:

ok single line: 'NO'

Test #13:

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

input:

8 3836

output:

YES
8 7 2 1 3 4 5 6

result:

ok 2 lines

Test #14:

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

input:

8 3837

output:

NO

result:

ok single line: 'NO'

Test #15:

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

input:

9 29228

output:

YES
9 8 4 1 2 3 5 6 7

result:

ok 2 lines

Test #16:

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

input:

9 29229

output:

NO

result:

ok single line: 'NO'

Test #17:

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

input:

9 32768

output:

NO

result:

ok single line: 'NO'

Test #18:

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

input:

2 1

output:

NO

result:

ok single line: 'NO'

Test #19:

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

input:

7 1

output:

NO

result:

ok single line: 'NO'

Test #20:

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

input:

13 296643390

output:

YES
13 12 11 7 1 2 3 4 5 6 8 9 10

result:

ok 2 lines

Test #21:

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

input:

13 296643391

output:

NO

result:

ok single line: 'NO'

Test #22:

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

input:

20 62119523114983223

output:

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

result:

ok 2 lines

Test #23:

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

input:

20 62119523114983224

output:

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

result:

ok 2 lines

Test #24:

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

input:

20 62119523114983225

output:

NO

result:

ok single line: 'NO'

Test #25:

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

input:

21 1

output:

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

result:

ok 2 lines

Test #26:

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

input:

21 1000000000000000000

output:

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

result:

ok 2 lines

Test #27:

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

input:

44 333333333333333333

output:

YES
1 2 3 4 5 6 7 8 9 10 11 21 42 44 41 40 43 38 39 35 34 37 36 32 31 33 29 27 28 25 30 26 23 24 15 22 18 16 20 19 17 12 13 14

result:

ok 2 lines

Test #28:

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

input:

49 600000000000000000

output:

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

result:

ok 2 lines

Test #29:

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

input:

16 738680521142

output:

YES
16 15 14 13 7 1 2 3 4 5 6 8 9 10 11 12

result:

ok 2 lines

Test #30:

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

input:

16 738680521143

output:

NO

result:

ok single line: 'NO'

Test #31:

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

input:

350 702274833889168257

output:

NO

result:

ok single line: 'NO'

Test #32:

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

input:

347 823694565238057857

output:

NO

result:

ok single line: 'NO'

Test #33:

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

input:

348 548514836018174081

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 2 lines

Test #34:

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

input:

349 1000000000000000000

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 2 lines

Test #35:

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

input:

17 11501573822788

output:

YES
17 16 15 14 11 1 2 3 4 5 6 7 8 9 10 12 13

result:

ok 2 lines

Test #36:

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

input:

17 11501573822789

output:

NO

result:

ok single line: 'NO'

Test #37:

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

input:

1536 1000000000000000000

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 2 lines

Test #38:

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

input:

1533 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 2 lines

Test #39:

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

input:

1534 639944301316494081

output:

NO

result:

ok single line: 'NO'

Test #40:

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

input:

1535 133749702370803553

output:

NO

result:

ok single line: 'NO'

Test #41:

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

input:

12 25598186

output:

YES
12 11 10 4 1 2 3 5 6 7 8 9

result:

ok 2 lines

Test #42:

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

input:

12 25598187

output:

NO

result:

ok single line: 'NO'

Test #43:

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

input:

5000 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 2 lines

Test #44:

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

input:

4997 577621398254762881

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 2 lines

Test #45:

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

input:

4998 1000000000000000000

output:

NO

result:

ok single line: 'NO'

Test #46:

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

input:

4999 1000000000000000000

output:

NO

result:

ok single line: 'NO'

Test #47:

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

input:

8 3836

output:

YES
8 7 2 1 3 4 5 6

result:

ok 2 lines

Test #48:

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

input:

8 3837

output:

NO

result:

ok single line: 'NO'

Test #49:

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

input:

30000 15298495309447071

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 2 lines

Test #50:

score: 0
Accepted
time: 4ms
memory: 23224kb

input:

29997 253859976519879617

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 2 lines

Test #51:

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

input:

29998 1

output:

NO

result:

ok single line: 'NO'

Test #52:

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

input:

29999 1000000000000000000

output:

NO

result:

ok single line: 'NO'

Test #53:

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

input:

5 10

output:

YES
3 2 4 5 1

result:

ok 2 lines

Test #54:

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

input:

5 25

output:

NO

result:

ok single line: 'NO'

Test #55:

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

input:

75000 1000000000000000000

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 2 lines

Test #56:

score: 0
Accepted
time: 19ms
memory: 48112kb

input:

74997 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 2 lines

Test #57:

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

input:

74998 952975592247715841

output:

NO

result:

ok single line: 'NO'

Test #58:

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

input:

74999 563899854863562881

output:

NO

result:

ok single line: 'NO'

Test #59:

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

input:

20 62119523114983182

output:

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

result:

ok 2 lines

Test #60:

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

input:

20 62119523114983324

output:

NO

result:

ok single line: 'NO'

Test #61:

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

input:

125000 890645059675041665

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 2 lines

Test #62:

score: 0
Accepted
time: 44ms
memory: 71164kb

input:

124997 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 2 lines

Test #63:

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

input:

124998 873954992112723841

output:

NO

result:

ok single line: 'NO'

Test #64:

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

input:

124999 248632969637282529

output:

NO

result:

ok single line: 'NO'

Test #65:

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

input:

17 11501573822775

output:

YES
17 16 15 14 9 2 3 1 4 5 6 7 8 10 11 12 13

result:

ok 2 lines

Test #66:

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

input:

17 11501573823343

output:

NO

result:

ok single line: 'NO'

Test #67:

score: 0
Accepted
time: 68ms
memory: 96188kb

input:

175000 1000000000000000000

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 2 lines

Test #68:

score: 0
Accepted
time: 47ms
memory: 98356kb

input:

174997 328322156846141249

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 2 lines

Test #69:

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

input:

174998 184010129245469601

output:

NO

result:

ok single line: 'NO'

Test #70:

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

input:

174999 988653544556724225

output:

NO

result:

ok single line: 'NO'

Test #71:

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

input:

16 738680521137

output:

YES
16 15 14 13 6 1 2 3 4 7 5 8 9 10 11 12

result:

ok 2 lines

Test #72:

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

input:

16 738680521147

output:

NO

result:

ok single line: 'NO'

Test #73:

score: 0
Accepted
time: 79ms
memory: 136784kb

input:

250000 265999253667994753

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 2 lines

Test #74:

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

input:

249997 1000000000000000000

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 2 lines

Test #75:

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

input:

249998 994057636750856961

output:

NO

result:

ok single line: 'NO'

Test #76:

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

input:

249999 728689378265228289

output:

NO

result:

ok single line: 'NO'