QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#673194#9428. Be PositiveyxfqlWA 0ms3684kbC++20742b2024-10-24 21:00:392024-10-24 21:00:42

Judging History

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

  • [2024-10-24 21:00:42]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3684kb
  • [2024-10-24 21:00:39]
  • 提交

answer

#include <iostream>
#include <vector>

using namespace std;

int main() {
    int T;
    cin >> T;
    
    while (T--) {
        int n;
        cin >> n;

        if (n % 4 == 0 || n % 4 == 3) {
            cout << "impossible" << endl;
        } else if (n % 4 == 1) {
            // Generate sequence: 1, 2, ..., n-1, 0
            for (int i = 1; i < n; i++) {
                cout << i << " ";
            }
            cout << 0 << endl;
        } else if (n % 4 == 2) {
            // Generate sequence: 1, 0, 2, 3, ..., n-1
            cout << "1 0 ";
            for (int i = 2; i < n; i++) {
                cout << i << " ";
            }
            cout << endl;
        }
    }

    return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 0
Wrong Answer
time: 0ms
memory: 3684kb

input:

4
1
2
3
4

output:

0
1 0 
impossible
impossible

result:

wrong answer xor equals zero (test case 1)