QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#87483#5742. Garbage DisposaltekolaWA 2ms3396kbC++17774b2023-03-13 10:36:502023-03-13 10:36:51

Judging History

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

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2023-03-13 10:36:51]
  • 评测
  • 测评结果:WA
  • 用时:2ms
  • 内存:3396kb
  • [2023-03-13 10:36:50]
  • 提交

answer

#include <bits/stdc++.h>

int main() {
    std::cin.tie(nullptr)->sync_with_stdio(false);

    int t;
    std::cin >> t;
    void solve();
    while (t--) solve();

    return 0;
}

void solve() {
    int l, r;
    std::cin >> l >> r;
    if (l == r) {
        if (l == 1) std::cout << "1\n";
        else std::cout << "-1\n";
    } else if ((r - l) & 1) {
        for (int i = l; i <= r; i++) {
            std::cout << (i == r ? l : i + 1) << " \n"[i == r];
        }
    } else if (l & 1) {
        std::cout << l + 1 << ' ' << l + 2 << ' ' << l << " \n"[r - l == 2];
        for (int i = l + 3; i <= r; i++) {
            std::cout << (i == r ? l + 3 : i + 1) << " \n"[i == r];
        }
    } else {
        std::cout << "-1\n";
    }
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 2ms
memory: 3376kb

input:

3
1 5
10 13
100 100

output:

2 3 1 5 4
11 12 13 10
-1

result:

ok 3 cases (3 test cases)

Test #2:

score: 0
Accepted
time: 2ms
memory: 3396kb

input:

2
1 1
10 12

output:

1
-1

result:

ok 2 cases (2 test cases)

Test #3:

score: -100
Wrong Answer
time: 2ms
memory: 3352kb

input:

2
9 13
3 9

output:

10 11 9 13 12
4 5 3 7 8 9 6

result:

wrong answer gcd(9, 6)=3 is not 1 (test case 2)