QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#306565 | #8004. Bit Component | ucup-team2303 | WA | 0ms | 3480kb | C++17 | 1.6kb | 2024-01-16 21:47:01 | 2024-01-16 21:47:02 |
Judging History
answer
// #pragma GCC optimize("O3")
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
// #pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,avx2,tune=native")
#include <bits/stdc++.h>
using namespace std;
#define PB emplace_back
// #define int long long
#define ll long long
#define vi vector<int>
#define siz(a) ((int) ((a).size()))
#define rep(i, a, b) for (int i = (a); i <= (b); ++i)
#define per(i, a, b) for (int i = (a); i >= (b); --i)
void print(vi n) { rep(i, 0, siz(n) - 1) cerr << n[i] << " \n"[i == siz(n) - 1]; }
vi get(int n) {
if(n == 1) return vi{0};
vi x = get(n >> 1), y = x;
reverse(y.begin(), y.end());
for(int z : y) x.PB(z + (n >> 1));
return x;
}
signed main() {
// freopen(".in", "r", stdin);
// freopen(".out", "w", stdout);
ios::sync_with_stdio(0);
cin.tie(0), cout.tie(0);
int a, b;
cin >> a;
if(a == 1) return cout << "YEs\n1", 0;
if(a == 3) return cout << "YES\n1 3 2", 0;
for(b = 1; (b << 1) <= a; b <<= 1);
if(b + b / 2 + 1 > a) return cout << "NO", 0;
cout << "YES\n";
vi n = get(b >> 1), ans;
ans.PB(b), ans.PB(b + b / 2);
rep(i, 1, siz(n) - 1) {
ans.PB(n[i] + b);
if(n[i] + b + b / 2 <= a && n[i] != 1) ans.PB(n[i] + b + b / 2);
}
ans.PB(1 + b + b / 2);
n = get(b);
reverse(next(n.begin()), n.end());
rep(i, 1, siz(n) - 1) ans.PB(n[i]);
for(int x : ans) cout << x << ' ';
cout << '\n';
cerr << siz(ans) << '\n';
for(int x : ans) {
per(j, 10, 0) cerr << ((x >> j) & 1);
cerr << '\n';
}
return cerr << endl << 1.0 * clock() / CLOCKS_PER_SEC << endl, 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 0
Wrong Answer
time: 0ms
memory: 3480kb
input:
1
output:
YEs 1
result:
wrong output format YES or NO expected in answer, but YEs found