QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#306589#8004. Bit Componentucup-team2303WA 1ms3920kbC++171.9kb2024-01-16 22:10:052024-01-16 22:10:06

Judging History

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

  • [2024-01-16 22:10:06]
  • 评测
  • 测评结果:WA
  • 用时:1ms
  • 内存:3920kb
  • [2024-01-16 22:10:05]
  • 提交

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));
	// reverse(x.begin(), x.end());
	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;
	if(a == 7) return cout << "YES\n6 4 5 7 2 3 1", 0;
	for(b = 1; (b << 1) <= a; b <<= 1);
	if(b + b / 2 + 1 > a) return cout << "NO", 0;
	// print(get(8));
	cout << "YES\n";
	vi n = get(b >> 1), ans;
	ans.PB(b + b / 2), ans.PB(b);
	reverse(next(n.begin()), n.end());
	rep(i, 1, siz(n) - 1) {
		if(n[i] + b + b / 2 <= a && n[i] != 1) ans.PB(n[i] + b + b / 2);
		ans.PB(n[i] + b);
	}
	ans.PB(1 + b + b / 2);
	n = get(b);
	reverse(next(n.begin()), n.end());
	print(n);
	rep(i, 1, siz(n) - 1) if(n[i] == b - 1) {
		reverse(n.begin() + 1, n.begin() + i + 1);
		// cout << "#!@##!@" << endl;
		break;
	}
	print(n);
	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: 100
Accepted
time: 1ms
memory: 3468kb

input:

1

output:

YES
1

result:

ok answer is 1

Test #2:

score: 0
Accepted
time: 0ms
memory: 3552kb

input:

2

output:

NO

result:

ok answer is 0

Test #3:

score: 0
Accepted
time: 0ms
memory: 3472kb

input:

3

output:

YES
1 3 2

result:

ok answer is 1

Test #4:

score: 0
Accepted
time: 0ms
memory: 3572kb

input:

4

output:

NO

result:

ok answer is 0

Test #5:

score: 0
Accepted
time: 0ms
memory: 3576kb

input:

5

output:

NO

result:

ok answer is 0

Test #6:

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

input:

6

output:

NO

result:

ok answer is 0

Test #7:

score: 0
Accepted
time: 0ms
memory: 3556kb

input:

7

output:

YES
6 4 5 7 2 3 1

result:

ok answer is 1

Test #8:

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

input:

8

output:

NO

result:

ok answer is 0

Test #9:

score: 0
Accepted
time: 0ms
memory: 3576kb

input:

9

output:

NO

result:

ok answer is 0

Test #10:

score: 0
Accepted
time: 0ms
memory: 3592kb

input:

10

output:

NO

result:

ok answer is 0

Test #11:

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

input:

11

output:

NO

result:

ok answer is 0

Test #12:

score: 0
Accepted
time: 0ms
memory: 3732kb

input:

12

output:

NO

result:

ok answer is 0

Test #13:

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

input:

13

output:

YES
12 8 10 11 9 13 7 5 4 6 2 3 1 

result:

ok answer is 1

Test #14:

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

input:

14

output:

YES
12 8 14 10 11 9 13 7 5 4 6 2 3 1 

result:

ok answer is 1

Test #15:

score: 0
Accepted
time: 0ms
memory: 3876kb

input:

15

output:

YES
12 8 14 10 15 11 9 13 7 5 4 6 2 3 1 

result:

ok answer is 1

Test #16:

score: 0
Accepted
time: 0ms
memory: 3516kb

input:

16

output:

NO

result:

ok answer is 0

Test #17:

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

input:

17

output:

NO

result:

ok answer is 0

Test #18:

score: 0
Accepted
time: 0ms
memory: 3576kb

input:

23

output:

NO

result:

ok answer is 0

Test #19:

score: 0
Accepted
time: 0ms
memory: 3588kb

input:

24

output:

NO

result:

ok answer is 0

Test #20:

score: -100
Wrong Answer
time: 1ms
memory: 3880kb

input:

25

output:

YES
24 16 20 21 23 22 18 19 17 25 15 14 10 11 9 8 13 12 4 5 7 6 2 3 1 

result:

wrong answer Participant's answer is incorrect