QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#304783 | #8004. Bit Component | ucup-team992# | WA | 1ms | 3752kb | C++17 | 841b | 2024-01-14 02:56:59 | 2024-01-14 02:57:00 |
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: 100
Accepted
time: 1ms
memory: 3512kb
input:
1
output:
YES 1
result:
ok answer is 1
Test #2:
score: 0
Accepted
time: 0ms
memory: 3596kb
input:
2
output:
NO
result:
ok answer is 0
Test #3:
score: 0
Accepted
time: 0ms
memory: 3504kb
input:
3
output:
YES 2 3 1
result:
ok answer is 1
Test #4:
score: 0
Accepted
time: 0ms
memory: 3724kb
input:
4
output:
NO
result:
ok answer is 0
Test #5:
score: 0
Accepted
time: 0ms
memory: 3456kb
input:
5
output:
NO
result:
ok answer is 0
Test #6:
score: 0
Accepted
time: 0ms
memory: 3752kb
input:
6
output:
NO
result:
ok answer is 0
Test #7:
score: 0
Accepted
time: 0ms
memory: 3500kb
input:
7
output:
YES 4 5 7 6 2 3 1
result:
ok answer is 1
Test #8:
score: 0
Accepted
time: 0ms
memory: 3508kb
input:
8
output:
NO
result:
ok answer is 0
Test #9:
score: 0
Accepted
time: 0ms
memory: 3580kb
input:
9
output:
NO
result:
ok answer is 0
Test #10:
score: 0
Accepted
time: 0ms
memory: 3580kb
input:
10
output:
NO
result:
ok answer is 0
Test #11:
score: 0
Accepted
time: 0ms
memory: 3476kb
input:
11
output:
NO
result:
ok answer is 0
Test #12:
score: 0
Accepted
time: 0ms
memory: 3524kb
input:
12
output:
NO
result:
ok answer is 0
Test #13:
score: -100
Wrong Answer
time: 0ms
memory: 3540kb
input:
13
output:
NO
result:
wrong answer Jury has the answer, participant doesn't