QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#505218#5742. Garbage DisposalchimeraWA 0ms3624kbC++14890b2024-08-04 22:34:312024-08-04 22:34:32

Judging History

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

  • [2024-08-04 22:34:32]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3624kb
  • [2024-08-04 22:34:31]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;
#define ll long long

ll gcd(ll x, ll y) {
    if(y == 0) return x;
    return gcd(y, x % y);
}

int main() {
    ll T; cin >> T;
    for(ll t = 0; t < T; t++) {
        ll L, R; cin >> L >> R;

        if(L == R) {
            cout << "-1\n"; continue;
        }

        // if even: always possible.

        if((R - L + 1)%2  == 0) {
            goodcase:
            for(ll i = L; i <= R; i += 2) {
                cout << i+1 << " " << i << " ";
            }
            cout << "\n";
            continue;
        }
        // evens > odds: always impossible.
        // o.w. possible. (3-cycle involving odds, and then evens.)

        if(!(L%2)) {
            cout << -1 << "\n"; continue;
        }

        cout << L+2 << " " << L << " " << L+1 << " "; L += 3;
        goto goodcase;
    }


}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 0ms
memory: 3624kb

input:

3
1 5
10 13
100 100

output:

3 1 2 5 4 
11 10 13 12 
-1

result:

ok 3 cases (3 test cases)

Test #2:

score: -100
Wrong Answer
time: 0ms
memory: 3580kb

input:

2
1 1
10 12

output:

-1
-1

result:

wrong answer Jury found answer but participant didn't (test case 1)