QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#87483 | #5742. Garbage Disposal | tekola | WA | 2ms | 3396kb | C++17 | 774b | 2023-03-13 10:36:50 | 2023-03-13 10:36:51 |
Judging History
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";
}
}
详细
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)