QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#304447#8004. Bit Componentucup-team1303#WA 1ms3496kbC++201.5kb2024-01-13 19:52:402024-01-13 19:52:41

Judging History

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

  • [2024-01-13 19:52:41]
  • 评测
  • 测评结果:WA
  • 用时:1ms
  • 内存:3496kb
  • [2024-01-13 19:52:40]
  • 提交

answer

// MagicDark
#include <bits/stdc++.h>
#define debug cerr << "[" << __LINE__ << "] "
#define SZ(x) (int) x.size() - 1
#define all(x) x.begin(), x.end()
#define ms(x, y) memset(x, y, sizeof x)
#define F(i, x, y) for (int i = (x); i <= (y); i++)
#define DF(i, x, y) for (int i = (x); i >= (y); i--)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
template <typename T> inline void chkmax(T& x, T y) {x = max(x, y);}
template <typename T> inline void chkmin(T& x, T y) {x = min(x, y);}
template <typename T> inline void read(T &x) {
	x = 0; int f = 1; char c = getchar();
	for (; !isdigit(c); c = getchar()) if (c == '-') f = -f;
	for (; isdigit(c); c = getchar()) x = (x << 1) + (x << 3) + (c ^ 48);
	x *= f;
}
vector <int> t;
signed main() {
	int n; cin >> n;
	int w = 31 ^ __builtin_clz(n);
	if ((1 << (w + 1)) - 1 != n) {
		puts("NO");
		return 0;
	}
	puts("YES");
	t.push_back(1);
	while (t.size() < n) {
		vector <int> tt;
		// for (int i: t) tt.push_back(i * 2), tt.push_back(i * 2 + 1);
		int g = t.size();
		// tt.push_back(1);
		// for (int i: t) {
		// 	tt.push_back(i * 2 + 1);
		// 	tt.push_back(i * 2);
		// }
		for (int i: t) tt.push_back(i);
		// // vector <int> tt(all(t));
		// // tt.push_back(g * 2 + 1);
		reverse(all(t));
		for (int i: t) tt.push_back(i + g + 1);
		tt.push_back(g + 1);
		// for (int i: t) tt.push_back(i | (g + 1));
		swap(t, tt);
	}
	for (int i: t) cout << i << " ";
	return 0;
}
/* why?
*/

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 0ms
memory: 3416kb

input:

1

output:

YES
1 

result:

ok answer is 1

Test #2:

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

input:

2

output:

NO

result:

ok answer is 0

Test #3:

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

input:

3

output:

YES
1 3 2 

result:

ok answer is 1

Test #4:

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

input:

4

output:

NO

result:

ok answer is 0

Test #5:

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

input:

5

output:

NO

result:

ok answer is 0

Test #6:

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

input:

6

output:

NO

result:

ok answer is 0

Test #7:

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

input:

7

output:

YES
1 3 2 6 7 5 4 

result:

ok answer is 1

Test #8:

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

input:

8

output:

NO

result:

ok answer is 0

Test #9:

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

input:

9

output:

NO

result:

ok answer is 0

Test #10:

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

input:

10

output:

NO

result:

ok answer is 0

Test #11:

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

input:

11

output:

NO

result:

ok answer is 0

Test #12:

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

input:

12

output:

NO

result:

ok answer is 0

Test #13:

score: -100
Wrong Answer
time: 0ms
memory: 3424kb

input:

13

output:

NO

result:

wrong answer Jury has the answer, participant doesn't