QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#673219#9428. Be PositiveyxfqlWA 0ms3584kbC++20640b2024-10-24 21:11:582024-10-24 21:11:58

Judging History

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

  • [2024-10-24 21:11:58]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3584kb
  • [2024-10-24 21:11:58]
  • 提交

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;
}

详细

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)