QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#605959#9428. Be PositiveKXDdesuWA 0ms3704kbC++23833b2024-10-02 20:56:452024-10-02 20:56:47

Judging History

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

  • [2024-10-02 20:56:47]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3704kb
  • [2024-10-02 20:56:45]
  • 提交

answer

#include<bits/stdc++.h>
#define all(x) (x).begin(), (x).end()
#define fi first
#define se second
#define lowbit(x) (x) & (-x)
using i64 = long long;
using pii = std::pair<int, int>;
void solve()
{
    int n;
    std::cin >> n;
    if (n == 1 || n % 4 == 0) {
    	std::cout << "impossible\n";
    }
    else {
    	std::cout << "1 0 ";
    	for (int i = 2; i < n; i ++) {
    		if (i % 4 == 2 && i != n - 1) {
    			std::cout << i + 1 << ' ';
    		}
    		else if (i % 4 == 3) {
    			std::cout << i - 1 << ' ';
    		}
    		else {
    			std::cout << i << ' ';
    		}
    	}
    	std::cout << '\n';
    }
}
int main()
{
    std::cin.tie(nullptr);
    std::cout.tie(nullptr);
    std::ios::sync_with_stdio(false);
    int T = 1;
    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: 3704kb

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: 3576kb

input:

10
1
2
3
4
5
6
7
8
9
10

output:

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

result:

wrong answer xor equals zero (test case 5)