QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#304679#8004. Bit Componentucup-team197#WA 1ms3508kbC++14862b2024-01-13 23:53:572024-01-13 23:53:58

Judging History

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

  • [2024-01-13 23:53:58]
  • 评测
  • 测评结果:WA
  • 用时:1ms
  • 内存:3508kb
  • [2024-01-13 23:53:57]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
int main(){
	ios::sync_with_stdio(false);cin.tie(0);
	int n;cin >> n;
	if(n<=3){
		if(n==1) cout << "YES\n1\n";
		if(n==2) cout << "NO\n";
		if(n==3) cout << "YES\2 3 1\n";
		return 0;
	}
	int k=1;
	while((1<<(k+1))<=n) ++k;
	if(n<=(1<<k)+(1<<(k-1))){
		cout << "NO\n";
		return 0;
	}
	vector<int>v={1};
	for(int i=1; i<=k-1 ;i++){
		int m=v.size();
		for(int j=m-1; j>=0 ;j--) v.push_back(v[j]+(1<<i));
		v.push_back(1<<i);
	}
	cout << "YES\n";
	reverse(v.begin(),v.end());
	int frog=(1<<k)+(1<<(k-1))+1;
	for(auto c:v){
		cout << c << " ";
		if((c>>(k-1))&1){
			if(c+(1<<k)!=frog) cout << c+(1<<k) << ' ';
		}
	}
	cout << frog << ' ';
	reverse(v.begin(),v.end());
	for(int i=0; i<(1<<(k-1))-1 ;i++){
		cout << v[i]+(1<<k) << ' ';
	}
	cout << frog-1 << ' ' << (1<<k) << '\n';
}

详细

Test #1:

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

input:

1

output:

YES
1

result:

ok answer is 1

Test #2:

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

input:

2

output:

NO

result:

ok answer is 0

Test #3:

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

input:

3

output:

YES\x02 3 1

result:

wrong output format YES or NO expected in answer, but YES\x02 found