QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#142815#5742. Garbage Disposalammardab3an#WA 0ms3596kbC++17701b2023-08-19 23:26:162023-08-19 23:26:17

Judging History

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

  • [2023-08-19 23:26:17]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3596kb
  • [2023-08-19 23:26:16]
  • 提交

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)