QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#124227#6667. Prosjekbashkort#0 197ms6748kbC++20769b2023-07-14 13:59:402024-07-04 00:39:32

Judging History

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

  • [2024-07-04 00:39:32]
  • 评测
  • 测评结果:0
  • 用时:197ms
  • 内存:6748kb
  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2023-07-14 13:59:40]
  • 提交

answer

#include <bits/stdc++.h>

using namespace std;
using ll = long long;

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);

    int test = 1;
    cin >> test;

    while (test--) {
        int n;
        cin >> n;

        vector<ll> a(n);

        for (int i = 0; i < n; ++i) {
            cin >> a[i];
        }

        stable_partition(a.begin(), a.end(), [&](ll x) { return x % 2 == 0; });

        if (a[n - 1] % 2 == 1 && a[n - 2] % 2 == 0) {
            cout << "-1\n";
            continue;
        }

        while (size(a) > 1) {
            cout << a.back() << " " << a.end()[-2] << '\n';
            a.end()[-2] = (a.end()[-2] + a.back()) / 2;
            a.pop_back();
        }
    }

    return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Subtask #1:

score: 0
Wrong Answer

Test #1:

score: 0
Wrong Answer
time: 1ms
memory: 3560kb

input:

99
4
739880851158065302 19206582949872932 883064254701115295 222072661880779376
7
148399819461615003 209088712310207988 53191076581680214 445068618251612752 230505279594622109 115754892157516718 804173775829453588
2
77979357045500669 41693388829622019
3
341612949433488278 609808714829036935 19994167...

output:

-1
230505279594622109 148399819461615003
189452549528118556 804173775829453588
496813162678786072 115754892157516718
306284027418151395 445068618251612752
375676322834882073 53191076581680214
214433699708281143 209088712310207988
41693388829622019 77979357045500669
-1
-1
663876810271466345 990307065...

result:

wrong answer you didn't find a solution but jury did (test case 1)

Subtask #2:

score: 0
Wrong Answer

Test #16:

score: 0
Wrong Answer
time: 0ms
memory: 3548kb

input:

100
3
3 3 2
3
4 1 1
4
1 3 4 4
6
4 4 2 3 1 2
4
0 2 1 4
3
0 2 0
7
3 3 1 1 3 4 0
2
0 4
4
1 4 2 3
7
4 0 0 3 2 3 4
4
4 2 0 3
7
0 2 2 1 4 2 4
7
3 0 3 1 2 0 3
4
4 3 1 4
6
2 3 0 1 3 4
5
1 4 0 3 4
5
4 2 0 4 2
3
0 1 2
6
4 1 4 2 0 4
7
4 2 4 3 1 3 1
4
1 4 4 0
2
1 1
6
0 3 3 0 0 4
7
4 3 0 3 3 3 4
4
4 1 1 3
6
2 0 ...

output:

3 3
3 2
1 1
1 4
3 1
2 4
3 4
1 3
2 2
2 2
2 4
3 4
-1
0 2
1 0
3 1
2 1
1 3
2 3
2 0
1 4
4 0
3 1
2 2
2 4
3 3
3 4
3 2
2 0
1 0
0 4
-1
-1
3 1
2 3
2 3
2 0
1 2
1 0
1 3
2 4
3 4
3 1
2 3
2 4
3 0
1 2
3 1
2 4
3 0
1 4
2 4
3 0
1 2
1 4
-1
-1
1 3
2 1
1 3
2 4
3 2
2 4
-1
1 1
3 3
3 4
3 0
1 0
0 0
3 3
3 3
3 3
3 4
3 0
1 4
3 ...

result:

wrong answer (3 + 2) is not an even number! (test case 1)

Subtask #3:

score: 0
Wrong Answer

Test #34:

score: 0
Wrong Answer
time: 116ms
memory: 3612kb

input:

100000
5
846784256447769304 457696478728961702 128469521648960690 597630796847754190 104256763714529164
5
658897822238868978 472135077337628566 399538027669313322 622703684108675696 425723088635325654
5
917704960887390986 140817562615382054 877934664521057998 782212806618666818 616380973421914538
8
...

output:

104256763714529164 597630796847754190
350943780281141677 128469521648960690
239706650965051183 457696478728961702
348701564847006442 846784256447769304
425723088635325654 622703684108675696
524213386372000675 399538027669313322
461875707020656998 472135077337628566
467005392179142782 658897822238868...

result:

wrong answer (350943780281141677 + 128469521648960690) is not an even number! (test case 1)

Subtask #4:

score: 0
Wrong Answer

Test #46:

score: 0
Wrong Answer
time: 197ms
memory: 6748kb

input:

100
211957
911918942087402387 344230223346742784 16289402153237664 528890583619159010 886281719684850237 865484734102017297 321851390502278959 754268375474197153 237414161302130571 135637002716682378 824412491959977735 162505521049217610 246319278060116103 666703181591704279 650875500699154233 96397...

output:

532418085391726079 759554573156793027
645986329274259553 553185893931599463
599586111602929508 591082823267833997
595334467435381752 750673279799819289
673003873617600520 708237805751519827
690620839684560173 274990826677686423
482805833181123298 749387671911821385
616096752546472341 596300148468541...

result:

wrong answer (599586111602929508 + 591082823267833997) is not an even number! (test case 1)