QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#621180#9428. Be PositiveMastey_WA 0ms3976kbC++14850b2024-10-08 10:38:142024-10-08 10:38:15

Judging History

This is the latest submission verdict.

  • [2024-10-08 10:38:15]
  • Judged
  • Verdict: WA
  • Time: 0ms
  • Memory: 3976kb
  • [2024-10-08 10:38:14]
  • Submitted

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()
{
	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++) ans[i]=i;
		for(int i=3;i<n;i++)
			if(i%4==0) swap(ans[i],ans[i+1]);
		for(int i=0;i<n;i++) printf("%d ",ans[i]);
		puts("");
	}
	return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

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: -100
Wrong Answer
time: 0ms
memory: 3788kb

input:

10
1
2
3
4
5
6
7
8
9
10

output:

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

result:

wrong answer xor equals zero (test case 5)