QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#673219 | #9428. Be Positive | yxfql | WA | 0ms | 3584kb | C++20 | 640b | 2024-10-24 21:11:58 | 2024-10-24 21:11:58 |
Judging History
answer
#include<bits/stdc++.h>
using i64 = long long;
void solve() {
int n;
std::cin>>n;
if(n==1||n%4==0){
std::cout<<"impossible\n";
return;
}
std::vector<int> a(n);
std::iota(a.begin(),a.end(),0);
std::swap(a[0],a[1]);
for(int i=2;i<n;i++){
if(i%4==0){
std::swap(a[i],a[i+1]);
}
}
for(auto num:a){
std::cout<<num<<" ";
}
std::cout<<"\n";
}
int main() {
std::ios::sync_with_stdio(false);
std::cin.tie(nullptr);
int t;
std::cin>>t;
while(t--){
solve();
}
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 0ms
memory: 3584kb
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: 3528kb
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)