QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#621169#9428. Be PositiveMastey_WA 33ms5900kbC++14934b2024-10-08 10:32:272024-10-08 10:32:27

Judging History

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

  • [2024-10-08 10:32:27]
  • 评测
  • 测评结果:WA
  • 用时:33ms
  • 内存:5900kb
  • [2024-10-08 10:32:27]
  • 提交

answer

#include<iostream>
#include<algorithm>
#include<cmath>
#include<cstring>
#include<string>
#include<cstdlib>
#include<iomanip>
#include<queue>
#include<vector>
#include<bitset>
#include<set>
#include<stack>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
const int maxn=1e6+5;
inline int read()
{
	int x=0,y=1; char c=getchar();
	while(c<'0'||c>'9') {if(c=='-') y=-1; c=getchar();}
	while(c>='0'&&c<='9') x=x*10+c-'0',c=getchar();
	return x*y;
}
int n,T;
bool st[maxn];
int ans[maxn];
int main()
{
	for(int base=2;base<=maxn;base<<=1) st[base-1]=1;
	T=read();
	while(T--)
	{
		n=read();
		if(n==1||n%4==0) {printf("impossible\n"); continue;}
		ans[0]=1; ans[1]=0; ans[2]=2;
		for(int i=3;i<n;i++)
		{
			if(i&&st[i-1]) continue;
			if(st[i]) ans[i]=i+1,ans[i+1]=i;
			else ans[i]=i;
		}
		for(int i=0;i<n;i++) printf("%d ",ans[i]),ans[i]=i;
		puts("");
	}
	return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

4
1
2
3
4

output:

impossible
1 0 
1 0 2 
impossible

result:

ok 4 test cases (4 test cases)

Test #2:

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

input:

10
1
2
3
4
5
6
7
8
9
10

output:

impossible
1 0 
1 0 2 
impossible
1 0 2 4 3 
1 0 2 4 3 5 
1 0 2 4 3 5 6 
impossible
1 0 2 4 3 5 6 8 7 
1 0 2 4 3 5 6 8 7 9 

result:

ok 10 test cases (10 test cases)

Test #3:

score: -100
Wrong Answer
time: 33ms
memory: 5900kb

input:

1413
1392
1306
297
726
1353
1059
111
758
1409
843
1013
940
1186
788
60
230
1249
209
776
966
178
25
168
494
70
867
601
195
718
497
1161
323
1054
265
148
388
186
539
760
1184
1230
829
400
460
1253
922
903
42
1347
1368
404
512
1170
378
136
560
1078
612
1201
30
717
934
572
975
255
1131
319
629
264
1240
...

output:

impossible
1 0 2 4 3 5 6 8 7 9 10 11 12 13 14 16 15 17 18 19 20 21 22 23 24 25 26 27 28 29 30 32 31 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 64 63 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...

result:

wrong answer xor equals zero (test case 2)