QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#103183 | #5742. Garbage Disposal | willow# | WA | 2ms | 3612kb | C++14 | 681b | 2023-05-04 17:40:44 | 2023-05-04 17:40:47 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
int T, l, r;
int main() {
for(scanf("%d", &T); T --; ) {
scanf("%d%d", &l, &r);
if((r - l + 1) % 2 == 0) {
for(int i = l; i <= r; ++ i) {
if(i % 2 == l % 2)
printf("%d ", i + 1);
else
printf("%d ", i - 1);
}
puts("");
}
else {
if(l == r) {
puts("-1");
continue;
}
if(l % 2 == 0 && r % 2 == 0)
puts("-1");
else {
printf("%d %d %d ", l + 1, l + 2, l);
for(int i = l + 3; i <= r; ++ i) {
if(i % 2 == (l + 3) % 2) {
printf("%d ", i + 1);
}
else {
printf("%d ", i - 1);
}
}
puts("");
}
}
}
}
详细
Test #1:
score: 100
Accepted
time: 2ms
memory: 3612kb
input:
3 1 5 10 13 100 100
output:
2 3 1 5 4 11 10 13 12 -1
result:
ok 3 cases (3 test cases)
Test #2:
score: -100
Wrong Answer
time: 2ms
memory: 3416kb
input:
2 1 1 10 12
output:
-1 -1
result:
wrong answer Jury found answer but participant didn't (test case 1)