QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#142815 | #5742. Garbage Disposal | ammardab3an# | WA | 0ms | 3596kb | C++17 | 701b | 2023-08-19 23:26:16 | 2023-08-19 23:26:17 |
Judging History
answer
#include <bits/stdc++.h>
#define ll long long
using namespace std;
int solve(){
int l,r;cin>>l>>r;
if(l==r)return cout<<-1<<'\n',0;
if((r-l+1)%2==0){
for(int i=l;i<=r;i+=2){
cout<<i + 1<<" "<<i<<' ';
}
cout<<'\n';
return 0;
}
if(l%2){
cout<<l + 1<<" "<<l + 2<<" "<<l<<" ";
for(int i=l+3;i<=r;i+=2){
cout<<i+1<<" "<<i<<' ';
}
cout<<'\n';
}else{
cout<<-1<<'\n';
}
return 0;
}
int main(){
ios::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
int t=1;
cin>>t;
while(t--){
solve();
}
return 0;
}
詳細信息
Test #1:
score: 100
Accepted
time: 0ms
memory: 3596kb
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: 0ms
memory: 3576kb
input:
2 1 1 10 12
output:
-1 -1
result:
wrong answer Jury found answer but participant didn't (test case 1)