QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#306564#8004. Bit Componentucup-team2303WA 0ms3612kbC++171.5kb2024-01-16 21:46:392024-01-16 21:46:40

Judging History

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

  • [2024-01-16 21:46:40]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3612kb
  • [2024-01-16 21:46:39]
  • 提交

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 == 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: 3612kb

input:

1

output:

NO

result:

wrong answer Jury has the answer, participant doesn't