QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#307354#8004. Bit Componentucup_team_qiuly#WA 0ms3944kbC++14421b2024-01-18 14:28:222024-01-18 14:28:23

Judging History

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

  • [2024-01-18 14:28:23]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3944kb
  • [2024-01-18 14:28:22]
  • 提交

answer

#include <iostream>
#include <cstdio>
using namespace std;
int n;
int ans[1048576];
int main(){
	cin>>n;
	int w=1;
	while((1<<w)<=n)w++;
	if ((1<<w)!=n+1){
		puts("NO");
		return 0;
	}
	else{
		puts("YES");
		ans[0]=0,ans[1]=1;
		for (int i=1;i<w;i++){
			for (int j=0;j<(1<<i);j++)ans[(1<<(i+1))-1-j]=ans[j]+(1<<i);
		}
		for (int i=1;i<=n;i++)printf("%d ",ans[i]);
		printf("\n");
	}
	return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

1

output:

YES
1 

result:

ok answer is 1

Test #2:

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

input:

2

output:

NO

result:

ok answer is 0

Test #3:

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

input:

3

output:

YES
1 3 2 

result:

ok answer is 1

Test #4:

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

input:

4

output:

NO

result:

ok answer is 0

Test #5:

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

input:

5

output:

NO

result:

ok answer is 0

Test #6:

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

input:

6

output:

NO

result:

ok answer is 0

Test #7:

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

input:

7

output:

YES
1 3 2 6 7 5 4 

result:

ok answer is 1

Test #8:

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

input:

8

output:

NO

result:

ok answer is 0

Test #9:

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

input:

9

output:

NO

result:

ok answer is 0

Test #10:

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

input:

10

output:

NO

result:

ok answer is 0

Test #11:

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

input:

11

output:

NO

result:

ok answer is 0

Test #12:

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

input:

12

output:

NO

result:

ok answer is 0

Test #13:

score: -100
Wrong Answer
time: 0ms
memory: 3608kb

input:

13

output:

NO

result:

wrong answer Jury has the answer, participant doesn't