QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#304782 | #8004. Bit Component | ucup-team992# | WA | 1ms | 3596kb | C++17 | 841b | 2024-01-14 02:56:14 | 2024-01-14 02:56:16 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
typedef int uci;
#define int long long
#define F first
#define S second
#define ar array
void solve(){
int n;
cin >> n;
int val = -1;
for(int i{1}; i < 20; ++i){
if((1<<i)-1 == n){
val = i;
}
}
if(val == -1){
cout << "No\n";
return;
}
vector<int> v;
v.push_back(1);
for(int i{2}; i <= val; ++i){
vector<int> ne;
ne.push_back(1<<(i-1));
for(int j = v.size()-1; j >= 0; --j){
ne.push_back((1<<(i-1)) | v[j]);
}
for(int i : v)
ne.push_back(i);
v.swap(ne);
}
cout << "Yes\n";
for(int i : v)
cout << i << ' ';
cout << '\n';
}
uci main(){
ios_base::sync_with_stdio(0);
cin.tie(0), cout.tie(0);
solve();
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 0
Wrong Answer
time: 1ms
memory: 3596kb
input:
1
output:
Yes 1
result:
wrong output format YES or NO expected in answer, but Yes found