QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#93779#5742. Garbage Disposalmaomao90#WA 2ms3376kbC++171.6kb2023-04-02 13:14:152023-04-02 13:14:17

Judging History

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

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2023-04-02 13:14:17]
  • 评测
  • 测评结果:WA
  • 用时:2ms
  • 内存:3376kb
  • [2023-04-02 13:14:15]
  • 提交

answer


// Hallelujah, praise the one who set me free
// Hallelujah, death has lost its grip on me
// You have broken every chain, There's salvation in your name
// Jesus Christ, my living hope
#include <bits/stdc++.h> 
using namespace std;

#define REP(i, s, e) for (int i = (s); i < (e); i++)
#define RREP(i, s, e) for (int i = (s); i >= (e); i--)
template <class T>
inline bool mnto(T& a, T b) {return a > b ? a = b, 1 : 0;}
template <class T>
inline bool mxto(T& a, T b) {return a < b ? a = b, 1: 0;}
typedef long long ll;
typedef long double ld;
#define FI first
#define SE second
typedef pair<int, int> ii;
typedef pair<ll, ll> pll;
typedef tuple<int, int, int> iii;
#define ALL(_a) _a.begin(), _a.end()
#define SZ(_a) (int) _a.size()
#define pb push_back
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<ii> vii;
typedef vector<iii> viii;

#ifndef DEBUG
#define cerr if (0) cerr
#endif

const int INF = 1000000005;
const ll LINF = 1000000000000000005ll;
const int MAXN = 200005;

int t;
int l, r;

int main() {
#ifndef DEBUG
    ios::sync_with_stdio(0), cin.tie(0);
#endif
    cin >> t;
    while (t--) {
        cin >> l >> r;
        if (l % 2 == 0 && (r - l) % 2 == 0) {
            cout << -1 << '\n';
            continue;
        }
        if ((r - l) % 2 == 0) {
            for (int i = l; i + 3 <= r; i += 2) {
                cout << i + 1 << ' ' << i << ' ';
            }
            cout << r << ' ' << r - 2 << ' ' << r - 1;
            cout << '\n';
        } else {
            for (int i = l; i <= r; i += 2) {
                cout << i + 1 << ' ' << i << ' ';
            }
            cout << '\n';
        }
    }
    return 0;
}

详细

Test #1:

score: 100
Accepted
time: 2ms
memory: 3324kb

input:

3
1 5
10 13
100 100

output:

2 1 5 3 4
11 10 13 12 
-1

result:

ok 3 cases (3 test cases)

Test #2:

score: -100
Wrong Answer
time: 2ms
memory: 3376kb

input:

2
1 1
10 12

output:

1 -1 0
-1

result:

wrong output format expected EOF after 2 cases (test case 2)