QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#511896 | #8322. 魔法手杖 | kymmykym | 0 | 584ms | 18792kb | C++14 | 790b | 2024-08-10 12:20:46 | 2024-08-10 12:20:46 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
#define int long long
const int maxn=100005;
int n,m,k;
int A[maxn],B[maxn];
const int oo = 1'000'000'000'000'000'000ll;
int dpdp(int bit, vector<int>&vec){
if(bit==-1)return 0;
if(vec.empty())return oo;
vector<int>lf,rg;
for(auto x:vec){
if(x&(1<<bit))rg.push_back(x);
else lf.push_back(x);
}
int res1=dpdp(bit-1,lf);
int res2=dpdp(bit-1,rg);
if(res1 == oo){
return res2+(1<<bit);
}
if(res2==oo){
return res1+(1<<bit);
}
return max(res1,res2);
}
void solve(){
cin>>n>>m>>k;
for(int i=1;i<=n;i++)cin>>A[i];
for(int i=1;i<=n;i++)cin>>B[i];
vector<int>as;
for(int i=1;i<=n;i++)as.push_back(A[i]);
cout<<dpdp(k,as)<<"\n";
}
int32_t main(){
int c,t;cin>>c>>t;
while(t--)solve();
}
Details
Tip: Click on the bar to expand more detailed information
Pretests
Final Tests
Test #1:
score: 0
Wrong Answer
time: 0ms
memory: 3740kb
input:
1 2 1 1 10 69 0 9 1000000000 10 244 710 380 144 439 863 870 166 346 495676227 842003627 148079269 750582321 584950601 767126829 909307499 254106473 942938842
output:
2046 1278
result:
wrong answer 1st lines differ - expected: '1092', found: '2046'
Test #2:
score: 0
Wrong Answer
time: 0ms
memory: 3600kb
input:
2 2 1 1 10 523 0 9 1000000000 10 848 862 206 186 563 318 692 557 937 922116005 577545690 363781833 81032507 443868714 352716275 50542823 305806582 28805127
output:
2046 1278
result:
wrong answer 1st lines differ - expected: '1546', found: '2046'
Test #3:
score: 0
Wrong Answer
time: 0ms
memory: 3604kb
input:
3 2 1 1 10 98 0 9 1000000000 10 329 357 633 469 110 721 457 238 51 40948203 144541423 719902898 403414385 625735025 473335146 107749900 238792543 449945390
output:
2046 1406
result:
wrong answer 1st lines differ - expected: '1121', found: '2046'
Test #4:
score: 0
Wrong Answer
time: 315ms
memory: 18644kb
input:
4 5 100000 0 30 76630934 108936482 130420626 131855744 105346843 128458246 108243259 68059982 126654362 129080907 113416035 106976866 67840827 131702105 31856035 114313339 128664146 83795983 89307173 119627353 87072570 90008429 101830816 86771207 109365348 78483596 96660700 94183829 84341841 6114378...
output:
2013282302 2147352588 2147383648 2013282302 2147352590
result:
wrong answer 1st lines differ - expected: '939540479', found: '2013282302'
Test #5:
score: 0
Wrong Answer
time: 321ms
memory: 18644kb
input:
5 5 100000 0 30 76630412 108936989 130419821 131855908 105346921 128458123 108243250 68060024 126653456 129080620 113415939 106976648 67840659 131702589 31855988 114313916 128664271 83796359 89307559 119627595 87072119 90007889 101830798 86770759 109365415 78484075 96661493 94184047 84342493 6114315...
output:
2013282302 2147352588 2147383648 2013282302 2147352590
result:
wrong answer 1st lines differ - expected: '939540479', found: '2013282302'
Test #6:
score: 0
Wrong Answer
time: 320ms
memory: 18788kb
input:
6 5 100000 0 30 76630333 108936734 130420608 131855493 105346592 128458438 108243159 68059640 126653892 129080993 113415838 106976338 67840970 131701923 31855999 114313236 128664302 83796315 89307977 119627172 87072644 90007888 101831307 86771011 109365285 78483904 96661399 94183858 84341903 6114386...
output:
2013282302 2147352588 2147383648 2013282302 2147352590
result:
wrong answer 1st lines differ - expected: '939540479', found: '2013282302'
Test #7:
score: 0
Wrong Answer
time: 550ms
memory: 3520kb
input:
7 250000 2 1 16 40654 60936 1 2 2 1 5 29 18 1 2 2 1 9 367 278 1 2 2 1 6 32 40 1 2 2 1 28 211414711 120442951 1 2 2 1 9 440 62 1 2 2 1 2 2 2 1 2 2 1 6 60 1 1 2 2 1 1 0 0 1 2 2 1 16 39195 9530 1 2 2 1 19 260304 52003 1 2 2 1 12 1492 2878 1 2 2 1 22 2112709 2056045 1 2 2 1 30 840827142 778131799 1 2 2 ...
output:
114686 54 958 118 402653182 766 6 94 2 98302 917502 6142 6291454 1879048190 1918 402653182 1610612734 46 25165822 25165822 393214 46 196606 458750 12286 62914558 2 25165822 2 1006632958 1966078 382 100663294 190 14 1534 12582910 1065353214 6 491518 2 2 28670 3070 14680062 110 32505854 110 8126462 12...
result:
wrong answer 1st lines differ - expected: '55295', found: '114686'
Test #8:
score: 0
Wrong Answer
time: 584ms
memory: 3816kb
input:
8 250000 2 1 24 7245747 7751903 1 2 2 1 18 7301 21614 1 2 2 1 2 1 3 1 2 2 1 3 0 4 1 2 2 1 22 1946046 3459042 1 2 2 1 1 0 1 1 2 2 1 27 110608129 62075905 1 2 2 1 7 79 78 1 2 2 1 1 0 0 1 2 2 1 8 190 156 1 2 2 1 29 213608577 61390223 1 2 2 1 21 194242 1613306 1 2 2 1 8 46 195 1 2 2 1 12 2674 3172 1 2 2...
output:
32505854 507902 4 10 6291454 2 201326590 254 2 478 939524094 3145726 382 7166 2 190 917502 229374 245758 4063230 117440510 6291454 3070 94 6291454 3070 28 15728638 14 114686 28670 786430 2 62 3582 3966 24574 446 469762046 12 3966 67076094 65011710 2 26 94 114686 3145726 3582 25165822 222 15728638 12...
result:
wrong answer 1st lines differ - expected: '16515071', found: '32505854'
Test #9:
score: 0
Wrong Answer
time: 311ms
memory: 18716kb
input:
9 40003 100000 1 30 76630623 108936745 130419844 131856358 105346889 128458736 108243812 68059447 126654184 129080977 113416077 106976936 67840619 131702296 31855896 114313546 128664506 83796193 89307481 119627719 87072176 90007912 101831608 86771305 109366220 78484119 96661356 94183598 84341931 611...
output:
2013282302 2147352588 2147383648 4094 1006632958 7166 1022 12320766 1476395006 62914558 32766 6142 3070 22 61438 350 2621438 12582910 2 10 12582910 98302 100663294 1610612734 46137342 190 15870 1073741822 738197502 1342177278 22 7340030 196606 1507326 12058622 393214 86 3070 16777214 268435454 23488...
result:
wrong answer 1st lines differ - expected: '939540479', found: '2013282302'
Test #10:
score: 0
Wrong Answer
time: 308ms
memory: 18792kb
input:
10 40003 100000 1 30 76630457 108937083 130420232 131855828 105346260 128458262 108242996 68059167 126653670 129080772 113416051 106976793 67840568 131702468 31855850 114313412 128664110 83796459 89307450 119627418 87071762 90007680 101831024 86771509 109365868 78483555 96661066 94183460 84342625 61...
output:
2013282302 2147352588 2147383648 134217726 2883582 100663294 8388606 167772158 894 12286 94 234881022 3070 134217726 100663294 14334 196606 7166 32766 4094 58 90110 1526 229374 2621438 30 402653182 917502 114686 65534 16252926 350 1572862 2097150 196606 2 1610612734 94 458750 22 766 528482302 20 884...
result:
wrong answer 1st lines differ - expected: '939540479', found: '2013282302'
Test #11:
score: 0
Wrong Answer
time: 293ms
memory: 18652kb
input:
11 40003 100000 1 30 76630674 108936653 130420433 131856265 105346983 128458653 108243409 68059656 126653505 129080757 113415755 106976914 67840002 131701979 31855773 114313774 128664187 83796634 89307850 119627507 87071827 90007813 101831495 86771399 109365557 78483822 96660811 94184023 84342680 61...
output:
2013282302 2147352588 2147383648 94 158 4094 100663294 4 49150 22 5242878 3145726 2942 117440510 382 12582910 1966078 771751934 11534334 12582910 4 24574 22 335544318 94 12582910 1610612734 10 12582910 62914558 20 22 702 1769470 6 939524094 62 134217726 32766 4 24117246 92274686 48894 254 10485758 2...
result:
wrong answer 1st lines differ - expected: '939540479', found: '2013282302'
Test #12:
score: 0
Wrong Answer
time: 284ms
memory: 18632kb
input:
12 40003 100000 1 30 76630775 108937143 130420127 131855472 105346114 128458369 108243185 68060064 126653745 129080952 113415931 106976535 67841016 131701837 31855974 114313669 128664055 83796306 89307860 119626895 87072131 90008292 101831649 86771064 109366112 78484048 96660693 94184079 84342338 61...
output:
2013282302 2147352588 2147383648 1534 766 16382 227326 28414 253950 10 131070 25165822 6291454 638 2 196606 188414 6142 25034750 62 2097150 7340030 94 7340030 23550 1073741822 702 28670 917502 134217726 12286 25165822 1610612734 12286 446 22 201326590 268435454 1610612734 2 6291454 98302 1022 100663...
result:
wrong answer 1st lines differ - expected: '939540479', found: '2013282302'
Test #13:
score: 0
Wrong Answer
time: 315ms
memory: 18588kb
input:
13 40003 100000 1 30 76630774 108936584 130420001 131856305 105347060 128457982 108243169 68059620 126654022 129081029 113415335 106976790 67840471 131702040 31855824 114314232 128663903 83796420 89307827 119626984 87072029 90008558 101830939 86770995 109365419 78483800 96660514 94183753 84342755 61...
output:
2013282302 2147352588 2147383648 24574 50331646 393214 12582910 268435454 3014654 4194302 1073741822 1572862 6291454 2147483646 100663294 22 766 766 766 31742 190 720894 393214 262142 3145726 4 94 134217726 22 49118 8 16777214 83886078 12582910 22 12286 2097150 8190 268435454 4194302 6142 3070 382 6...
result:
wrong answer 1st lines differ - expected: '939540479', found: '2013282302'
Test #14:
score: 0
Wrong Answer
time: 1ms
memory: 3632kb
input:
14 5 100 1000000000 30 13132 1189 129473 100435 99142 27988 125913 84108 88618 104500 18510 127909 33713 41539 73168 52981 93666 111173 97215 18318 116125 48796 66468 68341 66995 8141 6453 78522 5137 102161 79767 83305 55735 35923 57672 40415 26124 3517 89580 103805 63333 70578 15006 115257 25327 11...
output:
2147356670 2147483522 2147382270 2147356670 2147483524
result:
wrong answer 1st lines differ - expected: '1073641471', found: '2147356670'
Test #15:
score: 0
Wrong Answer
time: 1ms
memory: 3800kb
input:
15 5 100 1000000000 30 13147 1100 129952 101117 98742 27859 125802 84826 88433 104546 18804 127522 33108 41885 72848 52261 94114 110852 97024 17835 116004 48702 65612 68427 67541 7813 6415 78436 5289 102296 78964 83467 56256 36720 58141 39956 25783 3977 89405 104251 63057 69881 14546 115008 24936 10...
output:
2147356670 2147483522 2147382270 2147356670 2147483524
result:
wrong answer 1st lines differ - expected: '1073641471', found: '2147356670'
Test #16:
score: 0
Wrong Answer
time: 106ms
memory: 4904kb
input:
16 4003 10000 1000000000 60 6301301488220013 13036910415217886 3587708952967093 9679001900905121 15370074903700843 10699351669343223 3693263165367499 11069887286230748 16712579672850495 7401912839403587 2739985286259605 4571772340856038 7048969239142713 1894459710006182 17112800883496323 12320029364...
output:
524285 536854533 507901 12451838 1048573 29 29 1310718 20478 2621438 369098750 4194301 14333 184549374 2097149 369098750 61 3014654 262141 8 65533 6014 369098750 98301 15728637 8388605 -1 117440509 1789 4093 1476395006 13 8388605 -1342177282 46 229373 327678 16381 335544318 5 1406 -1610612738 2 9227...
result:
wrong answer 1st lines differ - expected: '1134974176306659327', found: '524285'
Test #17:
score: 0
Wrong Answer
time: 99ms
memory: 4860kb
input:
17 4003 10000 1000000000 60 6301301819534654 13036910822653667 3587709968963537 9679000983663529 15370074961371554 10699347928378657 3693263473368908 11069883997526525 16712580951412763 7401916234416503 2739986911540418 4571770484223398 7048969495053322 1894461412350279 17112799936179837 12320030978...
output:
524285 536854533 507901 23068670 2147483646 4194301 1048573 30717 524285 445 46 3014654 6142 12 2 32765 12058622 1577058302 65533 42 16381 57342 2883582 1441789 32765 38 12058622 2147483646 393214 4 125 125 126973 -805306370 16777213 29 524285 196606 61 1533 32765 2097149 49283070 509 125829118 249 ...
result:
wrong answer 1st lines differ - expected: '1134973076795031551', found: '524285'
Test #18:
score: 0
Wrong Answer
time: 106ms
memory: 4996kb
input:
18 4003 10000 1000000000 60 6301305150188370 13036910274580735 3587707298181505 9679004703165232 15370075141428877 10699349494581236 3693260766091278 11069885717856260 16712580184551432 7401916423007610 2739984412836669 4571773004118082 7048970479824295 1894458866748282 17112803260092779 12320029000...
output:
524285 536854533 516093 385022 1507326 8189 2942 -1610612738 786430 67108861 10 49149 167772158 671088638 22525 1021 28311550 2147483646 1310718 12285 -1342177282 1470 163838 184549374 393213 67108861 13 3070 -1342177282 41943038 1 86 6160382 20 26 6142 13310 1476395006 2147483647 92274686 184549374...
result:
wrong answer 1st lines differ - expected: '1134977474841542655', found: '524285'
Test #19:
score: 0
Time Limit Exceeded
input:
19 62501 100000 1000000000 120 1154838249421518343773531773357597778 1154838249421518343773531773357629327 1154838249421518343773531773357650307 1154838249421518343773531773357651709 1154838249421518343773531773357625821 1154838249421518343773531773357648391 1154838249421518343773531773357628650 115...
output:
result:
Test #20:
score: 0
Time Limit Exceeded
input:
20 62501 100000 1000000000 120 323632031276481459143358069001495634 323632031276481459143358069001527183 323632031276481459143358069001548163 323632031276481459143358069001549565 323632031276481459143358069001523677 323632031276481459143358069001546247 323632031276481459143358069001526506 3236320312...
output:
result:
Test #21:
score: 0
Time Limit Exceeded
input:
21 62501 100000 1000000000 120 94863733210630102424008628084424216 134857169996406520360367913319523910 161452665267901932764497978184577026 163229916633468866695669655916793917 130413130894076501442669761804067887 159024080878679252370015542440688101 133998758779238309221865949392709341 84253191505...
output:
result:
Test #22:
score: 0
Time Limit Exceeded
input:
22 120001 100000 1000000000 120 47471234275189825886337730002101330 47471234275189825886337730002132879 47471234275189825886337730002153859 47471234275189825886337730002155261 47471234275189825886337730002129373 47471234275189825886337730002151943 47471234275189825886337730002132202 4747123427518982...
output:
result:
Test #23:
score: 0
Time Limit Exceeded
input:
23 120001 100000 1000000000 120 10384594543745281933157089286344285 10384595087221325583432181750603761 10384596344313448100419024142756824 10384597896452402824418716086599406 10384599662161038685053136018241571 10384600136159512396111755729028709 10384601958291386084902861505361244 1038460344973912...
output:
result:
Test #24:
score: 0
Time Limit Exceeded
input:
24 120001 100000 1000000000 120 10384594585679242355840829886289379 10384595083750076569134324633632941 10384596423425537641166720528386677 10384598270636404608178558554968102 10384598723408000881156593449465505 10384600392016296777984789088889743 10384602014485619490959986853506329 1038460298717050...
output:
result:
Test #25:
score: 0
Time Limit Exceeded
input:
25 120001 100000 1000000000 120 10384594059032377855972206804990515 10384595922446112233978399250497752 10384596677646074836565734489994716 10384597585175584397302672981127521 10384599121981302637859909713499899 10384600188980133483790411300324684 10384601157708131158985167495674683 1038460244379676...