QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#612297#6428. K Co-prime Permutationzyq_313#WA 0ms3604kbC++14677b2024-10-05 10:20:012024-10-05 10:20:05

Judging History

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

  • [2024-10-05 10:20:05]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3604kb
  • [2024-10-05 10:20:01]
  • 提交

answer

#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>

using namespace std;

int n, k;

int main(){
    cin >> n >> k;

    if (k & 1){
        cout << 1;
        int b = 1;
        for (int i = 1; i <= k / 2; i ++){
            cout << ' ' << b + 2 << ' ' << b + 1;
            b += 2;
        }
        for (int i = b + 1; i <= n; i ++){
            cout << ' ' << i;
        }
    }else{
        int b = 1;
        for (int i = 1; i <= k / 2; i ++){
            cout << ' ' << b + 1 << ' ' << b;
            b += 2;
        }

        for (int i = b; i <= n; i ++){
            cout << ' ' << i;
        }
    }


}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

5 3

output:

1 3 2 4 5

result:

ok ac

Test #2:

score: -100
Wrong Answer
time: 0ms
memory: 3604kb

input:

1 0

output:

 1

result:

wrong answer wa