UOJ Logo

NOI.AC

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#214975#2481. 或nodgd50141ms4512kbC++111.1kb2024-11-25 18:49:592024-11-25 23:00:28

answer

#include <bits/stdc++.h>

using namespace std;

const int BUFFER_SIZE = 1 << 20;
char rb[BUFFER_SIZE], *rp = rb, *rt = rb;
inline char read_char() {
    return rp == rt ? (rt = rb + fread(rb, 1, BUFFER_SIZE, stdin), rp = rb, *rp ++) : *rp ++;
}
inline int read_int() {
    int x = 0;
    char ch = read_char(), flag = 0;
    while (ch != '-' && (ch < '0' || ch > '9')) {
        ch = read_char();
    }
    if (ch == '-') {
        flag = 1;
        ch = read_char();
    }
    for (x = 0; ch >= '0' && ch <= '9'; ch = read_char()) {
        x = x * 10 + (ch - '0');
    }
    return flag ? -x : x;
}

typedef long long i64;
const int MAX_N = 200000 + 5;

int N, a[MAX_N];
int al[MAX_N], ar[MAX_N];

int main() {
    N = read_int();
    int K = read_int(), X = read_int(), Y = 1;
    for (int i = 1; i <= K; i ++) Y *= X;
    for (int i = 1; i <= N; i ++) {
        a[i] = read_int();
        al[i] = al[i - 1] | a[i];
    }
    long long ans = 0;
    for (int i = N; i >= 1; i --) {
        ar[i] = ar[i - 1] | ar[i];
        ans = max(ans, al[i - 1] | ar[i + 1] | 1ll * a[i] * Y);
    }
    printf("%lld\n", ans);
    return 0;
}

详细

小提示:点击横条可展开更详细的信息

Subtask #1:

score: 0
Wrong Answer

Test #1:

score: 10
Accepted
time: 0ms
memory: 1160kb

input:

5 1 7
0 8 1048584 1572872 524296

output:

12058680

result:

ok single line: '12058680'

Test #2:

score: -10
Wrong Answer
time: 0ms
memory: 1164kb

input:

5 1 4
266252 262153 266249 9 262144

output:

1331245

result:

wrong answer 1st lines differ - expected: '1331257', found: '1331245'

Subtask #2:

score: 0
Wrong Answer

Test #11:

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

input:

5 3 4
4194308 0 4 0 4194304

output:

272629764

result:

wrong answer 1st lines differ - expected: '272630020', found: '272629764'

Subtask #3:

score: 0
Wrong Answer

Test #21:

score: 10
Accepted
time: 0ms
memory: 1164kb

input:

10 5 3
0 0 32776 8 33587200 33587200 33554432 32768 33554432 32768

output:

8161689608

result:

ok single line: '8161689608'

Test #22:

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

input:

10 1 5
1056 5242912 71303168 71304224 1536 4194304 72353280 72353312 72351776 72352800

output:

365960864

result:

ok single line: '365960864'

Test #23:

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

input:

10 2 4
545390608 268599312 32784 268533760 268501008 98321 805306384 813858817 537067537 537002000

output:

13835665425

result:

ok single line: '13835665425'

Test #24:

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

input:

10 2 3
33554693 34603141 33689920 33685508 33558789 4329728 1184005 5243268 33554821 38801411

output:

382898655

result:

ok single line: '382898655'

Test #25:

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

input:

10 5 2
135268608 142607360 537923840 147905536 542133504 536877088 546328576 146850080 143709472 134...

output:

18167291168

result:

ok single line: '18167291168'

Test #26:

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

input:

10 7 7
135827520 135823376 134976528 134905936 135988304 660496 234512 134287424 1115216 536908800

output:

442167619214416

result:

ok single line: '442167619214416'

Test #27:

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

input:

10 1 3
8751628 57864 12928012 37938692 4696076 12747272 575014404 4433920 578996228 37988360

output:

1741684236

result:

ok single line: '1741684236'

Test #28:

score: -10
Wrong Answer
time: 1ms
memory: 1164kb

input:

10 5 4
192938904 37758592 700450576 184820864 54797312 25297424 545391248 595592728 142614928 700580...

output:

717994469272

result:

wrong answer 1st lines differ - expected: '717995534232', found: '717994469272'

Subtask #4:

score: 0
Wrong Answer

Test #31:

score: 10
Accepted
time: 0ms
memory: 1164kb

input:

20 2 7
4 0 16777216 16777220 4 16777220 4 16777216 0 4 16777216 16777220 16777220 4 0 16777220 16777...

output:

822083780

result:

ok single line: '822083780'

Test #32:

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

input:

20 2 7
0 517 4128 37 37 4613 33 549 4129 4100 549 4644 548 4 1 0 4612 4 4129 4612

output:

228069

result:

ok single line: '228069'

Test #33:

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

input:

20 10 7
2097408 280 69206016 8397080 67108864 67117072 8448 77602833 10486033 77594889 75497472 7549...

output:

21920879650286361

result:

ok single line: '21920879650286361'

Test #34:

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

input:

20 7 6
402655296 134479872 393216 672008256 402915328 134613056 537790464 402786368 671352896 402655...

output:

225471794997312

result:

ok single line: '225471794997312'

Test #35:

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

input:

20 10 7
48243216 73925122 8921602 270866 180887680 210509968 213917840 8921106 48243346 73400320 209...

output:

60426495360722834

result:

ok single line: '60426495360722834'

Test #36:

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

input:

20 1 5
276837256 70018 8491946 276865698 25199496 16851384 16875787 32794 8463155 12953 276828714 25...

output:

1468658687

result:

ok single line: '1468658687'

Test #37:

score: -10
Wrong Answer
time: 0ms
memory: 1164kb

input:

20 8 6
2144 18360336 26216769 524784 537008 25176449 17834464 8921265 9973857 8403200 9965680 536704...

output:

44034105731440

result:

wrong answer 1st lines differ - expected: '44034114124273', found: '44034105731440'

Subtask #5:

score: 0
Wrong Answer

Test #41:

score: 10
Accepted
time: 0ms
memory: 1160kb

input:

20 10 5
262144 263168 262144 262144 1024 268435456 262144 1024 262144 262144 262144 0 262144 2686986...

output:

2624010268435456

result:

ok single line: '2624010268435456'

Test #42:

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

input:

20 3 8
67175488 256 67110272 1472 67174656 256 66560 1216 67175680 67110016 67109184 67109248 671091...

output:

34461124032

result:

ok single line: '34461124032'

Test #43:

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

input:

20 3 7
526096 17310464 16777488 16777472 1792 9728 17310720 17310992 17310480 16777216 532480 1280 5...

output:

5938020208

result:

ok single line: '5938020208'

Test #44:

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

input:

20 6 3
201335554 136839940 67633930 2106114 201853700 203950860 134228234 535308 134744320 201326600...

output:

148682800942

result:

ok single line: '148682800942'

Test #45:

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

input:

20 9 5
19136528 94405196 10748424 67108884 67404309 94404673 86278224 77627981 218104401 153354257 1...

output:

442945308045917

result:

ok single line: '442945308045917'

Test #46:

score: -10
Wrong Answer
time: 0ms
memory: 1160kb

input:

20 2 2
38404257 131072 34603265 306839809 339869889 272630112 106430465 302514561 105906336 37329321...

output:

1599734757

result:

wrong answer 1st lines differ - expected: '1601832421', found: '1599734757'

Subtask #6:

score: 10
Accepted

Test #51:

score: 10
Accepted
time: 0ms
memory: 1164kb

input:

500 3 6
536879104 536879104 536879104 8 8200 8192 536879104 8 536870920 8192 536879112 536879104 536...

output:

116502767304

result:

ok single line: '116502767304'

Test #52:

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

input:

500 3 8
6664 4609 6656 6664 2568 6657 2056 2568 521 6144 6664 2569 2057 6656 6656 4617 4617 6664 460...

output:

3414537

result:

ok single line: '3414537'

Test #53:

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

input:

500 7 3
17833984 29427968 4270080 4202496 4270080 1124608 17834240 5310464 29433856 13631744 2202009...

output:

66672621824

result:

ok single line: '66672621824'

Test #54:

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

input:

500 8 7
151060608 152089600 553648128 152088704 9512064 679515136 25244800 537952384 563150976 68063...

output:

4020457579590784

result:

ok single line: '4020457579590784'

Test #55:

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

input:

500 6 4
12583936 149423104 147330048 142609408 31464448 29365248 17305600 165679104 19402752 2936012...

output:

680918522880

result:

ok single line: '680918522880'

Test #56:

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

input:

500 4 4
67815680 201328640 526336 67797248 3147840 203604288 136497472 136839168 68845632 201885952 ...

output:

52596296000

result:

ok single line: '52596296000'

Test #57:

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

input:

500 10 7
950019089 943729696 538970225 473966640 505416722 35678227 343944274 245375011 247483409 71...

output:

279024329574252147

result:

ok single line: '279024329574252147'

Test #58:

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

input:

500 5 3
62670297 19404992 44587009 62417041 45091160 9177296 28339521 19666133 19151872 20715792 516...

output:

15229485021

result:

ok single line: '15229485021'

Test #59:

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

input:

500 7 6
35432736 134711721 135275112 40743577 139854457 37433769 173441561 136458808 175966896 58027...

output:

49269423733753

result:

ok single line: '49269423733753'

Test #60:

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

input:

500 4 7
889487457 806661235 268708368 17884695 2562 353403510 822124544 805584917 604031603 35233179...

output:

2138859433975

result:

ok single line: '2138859433975'

Subtask #7:

score: 10
Accepted

Test #61:

score: 10
Accepted
time: 0ms
memory: 1244kb

input:

5000 4 6
268435456 0 64 268435520 268435520 66 268435458 268435520 66 2 64 268435456 268435456 64 64...

output:

348160872034

result:

ok single line: '348160872034'

Test #62:

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

input:

5000 5 4
16843840 16843840 16786432 65600 1024 9280 66560 73792 16777280 66560 1088 64 65536 1678643...

output:

17273267264

result:

ok single line: '17273267264'

Test #63:

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

input:

5000 8 4
17825921 17039360 134217729 152313856 151265280 17891456 1310848 18161793 150994944 1710502...

output:

9986496602241

result:

ok single line: '9986496602241'

Test #64:

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

input:

5000 7 2
201334833 536936481 604315648 536936480 746651680 327729 545259536 8388608 8388608 53719862...

output:

96344553649

result:

ok single line: '96344553649'

Test #65:

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

input:

5000 10 4
18885206 4202640 20974160 543170758 2097878 553650326 555755654 16779474 553656404 5536503...

output:

587150707927766

result:

ok single line: '587150707927766'

Test #66:

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

input:

5000 3 4
17859956 554107396 17073668 1229604 16926497 19072580 17269312 16795221 556073508 540427524...

output:

36204699509

result:

ok single line: '36204699509'

Test #67:

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

input:

5000 6 4
10668192 78022318 69469244 69225114 75762238 2411686 75793546 78023326 2277428 75809840 134...

output:

319655243454

result:

ok single line: '319655243454'

Test #68:

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

input:

5000 8 7
8676225 335561061 270803296 8680375 77877296 77594902 77882086 268718708 343953904 67121845...

output:

1996476841260023

result:

ok single line: '1996476841260023'

Test #69:

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

input:

5000 9 3
286851378 17517184 268522276 16916502 269109504 353446576 269041722 353446668 354027806 337...

output:

6970549469182

result:

ok single line: '6970549469182'

Test #70:

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

input:

5000 3 5
74490019 337648263 22291074 90486788 17872896 352364704 292554758 354685092 289415811 70529...

output:

45097155567

result:

ok single line: '45097155567'

Subtask #8:

score: 10
Accepted

Test #71:

score: 10
Accepted
time: 0ms
memory: 4460kb

input:

200000 1 2
136 524288 524296 524416 136 128 524288 128 136 0 136 136 136 0 128 0 524424 0 524416 524...

output:

1573272

result:

ok single line: '1573272'

Test #72:

score: 0
Accepted
time: 8ms
memory: 4508kb

input:

200000 1 3
67108865 16777217 21037056 65537 20971521 1 16842753 16842753 67108865 83951617 65536 209...

output:

264437763

result:

ok single line: '264437763'

Test #73:

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

input:

200000 1 3
134418440 402788392 402718760 196664 135216 134217752 40 402853912 134807608 725000 40285...

output:

1479225528

result:

ok single line: '1479225528'

Test #74:

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

input:

200000 1 2
536871951 33794 537001993 671252488 537001990 131080 134217738 132103 134251523 671089675...

output:

2013760543

result:

ok single line: '2013760543'

Test #75:

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

input:

200000 1 3
796800 2762752 2100640 2229408 158880 2384896 2508960 2884640 3032480 2124192 2386304 402...

output:

11501536

result:

ok single line: '11501536'

Test #76:

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

input:

200000 1 2
940310800 805315088 139207268 805306416 939786292 675807568 134750244 138674964 809771636...

output:

2027710460

result:

ok single line: '2027710460'

Test #77:

score: 0
Accepted
time: 8ms
memory: 4512kb

input:

200000 1 2
538002688 22016 271872 538001984 2115392 572600384 571487552 36964096 16384 572588864 540...

output:

1719664576

result:

ok single line: '1719664576'

Test #78:

score: 0
Accepted
time: 8ms
memory: 4512kb

input:

200000 1 2
878103600 939967672 618053656 2411824 811994168 939689072 550817248 548456904 149340288 8...

output:

2113921016

result:

ok single line: '2113921016'

Test #79:

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

input:

200000 1 5
718277636 540311600 947126292 849710084 584420392 820347908 854656016 570426372 14943272 ...

output:

5368692028

result:

ok single line: '5368692028'

Test #80:

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

input:

200000 1 5
845562150 71840768 811598720 342492322 644228646 70140706 604387204 839398404 541746722 1...

output:

5368709054

result:

ok single line: '5368709054'

Subtask #9:

score: 10
Accepted

Test #81:

score: 10
Accepted
time: 5ms
memory: 4512kb

input:

200000 6 7
67108864 536870912 71303168 67108864 608174080 541065216 67108864 608174080 536870912 536...

output:

71551676317696

result:

ok single line: '71551676317696'

Test #82:

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

input:

200000 1 3
134807552 134746112 0 138940416 134808576 4194304 134217728 65536 529408 138478592 139006...

output:

417020928

result:

ok single line: '417020928'

Test #83:

score: 0
Accepted
time: 8ms
memory: 4508kb

input:

200000 1 5
33088 276824424 32888 268468560 268435768 276856848 8388880 268435560 268468288 33056 268...

output:

1384286200

result:

ok single line: '1384286200'

Test #84:

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

input:

200000 10 8
85004936 8388616 95945344 19988616 87625736 67179144 87036544 78709376 26738696 93913600...

output:

103095304147505800

result:

ok single line: '103095304147505800'

Test #85:

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

input:

200000 7 5
538970177 807403592 2105346 543199304 2099265 536883272 6297673 538980360 536883275 53900...

output:

63409823398863

result:

ok single line: '63409823398863'

Test #86:

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

input:

200000 1 4
538249216 1114634 303368448 302056203 268698368 839977729 327946 1377032 269551624 2819 3...

output:

4199886639

result:

ok single line: '4199886639'

Test #87:

score: 0
Accepted
time: 6ms
memory: 4508kb

input:

200000 4 7
369132098 369132592 101191270 343966362 369624602 109088380 42500230 268994662 335545360 ...

output:

907714494206

result:

ok single line: '907714494206'

Test #88:

score: 0
Accepted
time: 8ms
memory: 4508kb

input:

200000 4 8
440602628 303178244 674767104 438903040 3879686 287846916 321003522 274866182 274801412 8...

output:

4087659328262

result:

ok single line: '4087659328262'

Test #89:

score: 0
Accepted
time: 6ms
memory: 4508kb

input:

200000 2 6
559466891 21078031 5859468 5810311 542729250 18735 4827151 559505734 22079553 536871183 5...

output:

20166082559

result:

ok single line: '20166082559'

Test #90:

score: 0
Accepted
time: 8ms
memory: 4508kb

input:

200000 4 2
721760326 957367302 688211024 655619152 143672338 555188240 369136640 914403392 218562560...

output:

16106124662

result:

ok single line: '16106124662'

Subtask #10:

score: 10
Accepted

Test #91:

score: 10
Accepted
time: 5ms
memory: 4508kb

input:

200000 7 2
4 67108864 4 67108868 1 1 67108869 0 67108869 67108868 67108864 1 67108864 67108868 67108...

output:

8657044101

result:

ok single line: '8657044101'

Test #92:

score: 0
Accepted
time: 2ms
memory: 4512kb

input:

200000 10 5
268501120 553648130 268435456 285212800 16777346 536936450 805306496 822149250 805372034...

output:

8028801269596914

result:

ok single line: '8028801269596914'

Test #93:

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

input:

200000 7 6
570950536 34078976 67113352 603984000 34083200 67634048 537400200 264 603984256 537395720...

output:

178616942821256

result:

ok single line: '178616942821256'

Test #94:

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

input:

200000 2 6
1581056 33579296 1573156 102261028 1589540 100679684 67657728 101187584 35135780 67649572...

output:

3749570980

result:

ok single line: '3749570980'

Test #95:

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

input:

200000 9 7
16416 537395712 16785952 557896224 20971552 541606432 537088 17314304 20980256 536899616 ...

output:

22534613012969184

result:

ok single line: '22534613012969184'

Test #96:

score: 0
Accepted
time: 8ms
memory: 4512kb

input:

200000 9 2
32505858 697438224 17858560 685785088 756027408 136500226 676463618 84939792 211980288 62...

output:

394834670610

result:

ok single line: '394834670610'

Test #97:

score: 0
Accepted
time: 9ms
memory: 4512kb

input:

200000 7 2
539099673 537086483 150077961 101842961 713050138 106971137 570492931 706805770 780157441...

output:

100931162011

result:

ok single line: '100931162011'

Test #98:

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

input:

200000 1 4
673260672 545996800 680215680 679698560 950666240 447881216 436805632 144851072 540672000...

output:

4211078784

result:

ok single line: '4211078784'

Test #99:

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

input:

200000 5 3
307822885 852542780 839925788 306742272 35767337 547898652 548455684 303661113 537411601 ...

output:

208289133951

result:

ok single line: '208289133951'

Test #100:

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

input:

200000 10 4
72100161 269574208 811436225 273245440 609796440 609347800 72444048 272687313 542402625 ...

output:

921248965979609

result:

ok single line: '921248965979609'