QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#197746#3515. Colourful ChameleonsIsaacMoris#AC ✓26ms3916kbC++14835b2023-10-02 19:19:392023-10-02 19:19:39

Judging History

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

  • [2023-10-02 19:19:39]
  • 评测
  • 测评结果:AC
  • 用时:26ms
  • 内存:3916kb
  • [2023-10-02 19:19:39]
  • 提交

answer

#include<iostream>
#include <bits/stdc++.h>

#define ll long long
#define ld long double
#define IO ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
using namespace std;
const int N = 100 + 5, inf = 2e9;

void doWork() {
    int n, c, y;
    ll b = 0;
    cin >> n >> c >> y;

    int a = 0;
    set<int> vis;
    for (int i = 1; i <= n; i++) {
        int x;
        cin >> x;
        b += x;
        if (i != c) {
            vis.insert(x % (y + 1));
            a = max(a, x);
        }
    }
    if (vis.size() == 1) {
        cout << a << " " << b + 1ll * a * (y - n + 1);
    } else {
        cout << "impossible";
    }
}

int main() {
    //IO
    int t = 1;
    //   cin >> t;
    for (int i = 1; i <= t; i++) {
        //  cout << "Case #" << i << ": ";
        doWork();
    }
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

3 2 2
2 3 5

output:

5 10

result:

ok single line: '5 10'

Test #2:

score: 0
Accepted
time: 1ms
memory: 3416kb

input:

3 1 3
2 2 3

output:

impossible

result:

ok single line: 'impossible'

Test #3:

score: 0
Accepted
time: 5ms
memory: 3832kb

input:

8947 3793 15585619
135485693 35237323 78584306 587907915 820777698 336428818 511413499 580407878 76160329 102213523 162477679 398083570 16029020 602530181 612848766 384511185 883188432 57678789 660006157 75245280 122838981 572420587 797877368 513909590 963784017 452532980 738231354 245057142 9062526...

output:

impossible

result:

ok single line: 'impossible'

Test #4:

score: 0
Accepted
time: 4ms
memory: 3820kb

input:

9098 6524 654045259
224312182 491985417 295768021 289630913 87838668 372215622 733971228 105298626 205907833 782426614 827903845 136294101 864114289 352850107 524338898 57964227 973200277 595290369 199813343 431629875 979894628 817894220 170013136 5067211 341263285 541572212 845018771 53047538 39811...

output:

impossible

result:

ok single line: 'impossible'

Test #5:

score: 0
Accepted
time: 4ms
memory: 3916kb

input:

9244 1190 619903963
323929724 740397417 387209923 856697322 994915535 550721985 131183913 257258392 390630397 659712472 210743006 512272616 42645524 208195415 605498639 40097247 434187722 249212268 68539863 741387315 938579069 829588819 165543759 560031834 649713658 684355284 177721373 797741729 748...

output:

impossible

result:

ok single line: 'impossible'

Test #6:

score: 0
Accepted
time: 1ms
memory: 3436kb

input:

511 485 867
6210 4708 3999 3067 7231 9940 2706 515 4321 6125 6119 5386 8188 7456 6303 6092 7981 8580 8986 5114 4129 760 4198 7791 3838 1988 4687 8561 7177 9165 894 6382 7836 873 5996 4167 8171 2836 1258 5390 1168 7523 3381 3937 7839 1508 6855 1231 2917 4333 1665 1405 5743 7307 7024 3043 9407 5346 80...

output:

impossible

result:

ok single line: 'impossible'

Test #7:

score: 0
Accepted
time: 1ms
memory: 3520kb

input:

173 24 388
9382 2547 7693 4046 9020 2363 5264 5528 9625 5319 4567 3835 5997 311 5336 4955 2800 4256 4814 3361 3168 9263 7709 4245 1912 2064 6155 6172 5729 4838 7554 4962 748 5175 588 4741 3043 2624 8929 9197 7085 9674 2264 3752 1182 6018 684 8502 3226 2416 4690 7058 7906 2966 4715 7400 919 2300 2536...

output:

impossible

result:

ok single line: 'impossible'

Test #8:

score: 0
Accepted
time: 1ms
memory: 3440kb

input:

933 293 993
4151 2105 8490 5193 9419 1600 9178 9045 7805 7801 4412 4540 5399 9456 2336 5859 981 5351 9010 1754 5526 8485 8602 2267 8843 2960 1968 8268 8121 6127 2721 9357 8570 8417 6601 8384 7052 1084 9660 7974 4936 1958 5648 4857 8625 5538 2127 3949 8185 2816 1429 2979 2269 2497 2833 6116 2906 5237...

output:

impossible

result:

ok single line: 'impossible'

Test #9:

score: 0
Accepted
time: 0ms
memory: 3452kb

input:

10 7 19
19 70 11 38 45 35 53 87 67 86

output:

impossible

result:

ok single line: 'impossible'

Test #10:

score: 0
Accepted
time: 0ms
memory: 3396kb

input:

8 4 15
17 85 87 35 71 94 49 27

output:

impossible

result:

ok single line: 'impossible'

Test #11:

score: 0
Accepted
time: 0ms
memory: 3404kb

input:

10 8 20
79 74 91 77 53 85 46 55 88 83

output:

impossible

result:

ok single line: 'impossible'

Test #12:

score: 0
Accepted
time: 26ms
memory: 3396kb

input:

100000 100000 1000000000
1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 ...

output:

1000000000 1000000001000000000

result:

ok single line: '1000000000 1000000001000000000'

Test #13:

score: 0
Accepted
time: 1ms
memory: 3396kb

input:

2 1 1
1 1

output:

1 2

result:

ok single line: '1 2'

Test #14:

score: 0
Accepted
time: 0ms
memory: 3448kb

input:

2 1 1
123456789 987654321

output:

987654321 1111111110

result:

ok single line: '987654321 1111111110'

Test #15:

score: 0
Accepted
time: 4ms
memory: 3396kb

input:

10000 8566 9118009
969586452 303971722 750754212 303971722 933114412 696046152 285735702 914878392 960468442 194555602 632220082 422505852 960468442 805462272 996940482 860170332 577512022 194555602 778108242 112493512 349561772 249263662 276617692 376915802 39549432 513685952 30431422 130729532 376...

output:

996940482 9085254627487464

result:

ok single line: '996940482 9085254627487464'

Test #16:

score: 0
Accepted
time: 3ms
memory: 3412kb

input:

10000 6477 7827529
690348339 424212319 252006659 71973469 197213949 690348339 792106229 369419609 510315149 807761289 267661719 666865749 471177499 236351599 737313519 823416349 666865749 244179129 275489249 706003399 651210689 408557259 541625269 71973469 510315149 972139419 510315149 901691649 471...

output:

995622009 7788297997351466

result:

ok single line: '995622009 7788297997351466'

Test #17:

score: 0
Accepted
time: 3ms
memory: 3416kb

input:

10000 7828 3586174
282132403 231925953 74134253 70548078 74134253 547509353 913299203 977850353 619232853 916885378 759093678 590543453 242684478 744748978 726818103 511647603 540337003 56203378 608474328 138685403 38272503 170960978 389717653 741162803 576198753 167374803 242684478 124340703 604888...

output:

999367403 3578950533611944

result:

ok single line: '999367403 3578950533611944'

Test #18:

score: 0
Accepted
time: 3ms
memory: 3396kb

input:

10000 5052 8810127
301646497 486659185 592380721 19722401 204735089 750963025 953595969 107823681 953595969 742152897 935975713 698102257 565950337 777393409 495469313 574760465 116633809 345697137 980026353 988836481 988836481 865494689 107823681 46152785 662861745 284026241 654051617 865494689 354...

output:

997646609 8784451530055637

result:

ok single line: '997646609 8784451530055637'

Test #19:

score: 0
Accepted
time: 0ms
memory: 3512kb

input:

122 68 3446
169360 231406 600235 724327 776032 441673 114208 265876 514060 813949 648493 572659 631258 176254 310687 524401 3904 462355 386521 786373 593341 872548 38374 707092 21139 875995 782926 238300 210724 252088 103867 500272 738115 34927 875995 252088 210724 731221 848419 121102 614023 34927 ...

output:

996640 3367488393

result:

ok single line: '996640 3367488393'

Test #20:

score: 0
Accepted
time: 1ms
memory: 3412kb

input:

799 495 8889
739093 63453 347933 605743 312373 756873 223473 36783 943563 819103 427943 623523 285703 152353 339043 267923 187913 552403 827993 961343 979123 116793 134573 623523 285703 445723 356823 854663 170133 481283 579073 312373 836883 454613 81233 134573 356823 614633 72343 383493 996903 8724...

output:

996903 8469391405

result:

ok single line: '996903 8469391405'

Test #21:

score: 0
Accepted
time: 0ms
memory: 3480kb

input:

354 72 909
390115 630355 836925 579395 921555 7915 222675 488395 200835 792335 470195 589405 153515 428335 211755 640365 403765 969785 460185 131675 573025 57055 331875 757755 736825 287285 360995 431065 382835 613975 208115 411045 566655 508415 589405 472015 352805 850575 335515 78895 624895 70705 ...

output:

999815 734466453

result:

ok single line: '999815 734466453'

Test #22:

score: 0
Accepted
time: 0ms
memory: 3488kb

input:

5 3 19
38 78 26 98 78

output:

98 1788

result:

ok single line: '98 1788'

Test #23:

score: 0
Accepted
time: 0ms
memory: 3408kb

input:

10 10 19
67 67 47 47 67 27 67 47 87 64

output:

87 1457

result:

ok single line: '87 1457'

Test #24:

score: 0
Accepted
time: 0ms
memory: 3396kb

input:

8 2 20
95 70 74 95 95 32 74 53

output:

95 1823

result:

ok single line: '95 1823'