QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#727509#9575. $P \oplus Q = R$ucup-team5657#WA 1ms3756kbC++141.7kb2024-11-09 13:18:282024-11-09 13:18:37

Judging History

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

  • [2024-11-10 08:23:38]
  • hack成功,自动添加数据
  • (/hack/1156)
  • [2024-11-09 13:18:37]
  • 评测
  • 测评结果:WA
  • 用时:1ms
  • 内存:3756kb
  • [2024-11-09 13:18:28]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;
#define _rep(i_,a_,b_) for(int i_ = (a_); i_ <= (b_); ++i_)
#define mid ((L+R) >> 1)
#define multiCase() int testCnt = in(); _rep(curCase,1,testCnt)
#ifdef ONLINE_JUDGE
#define debug(...) 0
#else
#define debug(...) fprintf(stderr, __VA_ARGS__), fflush(stderr)
#endif
using ll = long long;
using pii = pair<int,int>;

int in(void) { int x; scanf("%d", &x); return x; } ll inl(void) { ll x; scanf("%lld", &x); return x; }
void out(int x) { printf("%d ", x); } void outln(int x) { printf("%d\n", x); }
void out(ll x) { printf("%lld ", x); } void outln(ll x) { printf("%lld\n", x); }
template<typename T> void chkmax(T &a, const T &b) { a = max(a, b); } 
template<typename T> void chkmin(T &a, const T &b) { a = min(a, b); } 

int main() {
	multiCase() {
		int n = in();
		if((n & (n - 1)) || n <= 2) puts("No");
		else {
			puts("Yes");
			vector<int> f = {0, 2, 3, 1};
			while(f.size() != n) {
				vector<int> g = f; for(auto &u : g) u += f.size();
				vector<int> h(f.size() * 2); 
				_rep(i,0,f.size() / 2 - 1) h[i] = f[i];
				_rep(i,0,f.size() / 2 - 1) h[i+f.size()/2] = g[i];
				_rep(i,f.size()/2,f.size()-1)h[i+f.size()/2]=f[i];
				_rep(i,f.size()/2,f.size()-1)h[i+f.size()]=g[i];
				f = h;
			}
			_rep(i,0,n - 1) out(i); puts("");
			_rep(i,0,n - 1) out(f[i]); puts("");
		}
	}
	// int n = in();
	// vector<int> p(n), q(n);
	// _rep(i,0,n - 1) p[i] = i, q[i] = in();
	// do {
	// 	vector<int> r(n);
	// 	_rep(i,0,n - 1) r[i] = p[i] ^ q[i];
	// 	sort(r.begin(), r.end());
	// 	if(r == p) {
	// 		for(auto &u : q) out(u); puts("");
	// 		return 0;
	// 	}
	// } while(next_permutation(q.begin(), q.end()));
	return 0;
}

详细

Test #1:

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

input:

2
3
4

output:

No
Yes
0 1 2 3 
0 2 3 1 

result:

ok Correct. (2 test cases)

Test #2:

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

input:

1999
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101...

output:

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

result:

wrong answer Testcase 1, n = 1, Jury has better solution. (test case 1)