QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#479741#1004. 快速 XOR 卷积Justin#0 32ms10828kbC++14789b2024-07-15 20:38:372024-07-15 20:38:37

Judging History

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

  • [2024-07-15 20:38:37]
  • 评测
  • 测评结果:0
  • 用时:32ms
  • 内存:10828kb
  • [2024-07-15 20:38:37]
  • 提交

answer

#include<bits/stdc++.h>

using lld=long long;

const int N=20,mod=998244353;

int n;

lld A[1<<N|5],B[1<<N|5];

void FWT(lld *F,int ty){
    for(int h=1;h<(1<<n);h<<=1)
        for(int i=0;i<(1<<n);i+=(h<<1))
            for(int j=0;j<h;++j){
                lld t1=F[i+j],t2=F[i+j+h];
                F[i+j]=ty*(t1+t2)%mod,F[i+j+h]=ty*(t1-t2)%mod;
            }
}

int main(){
    scanf("%d",&n);
    for(int i=0;i<(1<<n);++i) scanf("%lld",A+i);
    for(int i=0;i<(1<<n);++i) scanf("%lld",B+i);
    FWT(A,1),FWT(B,1);
    for(int i=0;i<(1<<n);++i) (A[i]*=B[i])%=mod;
    FWT(A,-1);
    lld inv2=(mod+1)/2,pw=1;
    for(int i=1;i<=n;++i) (pw*=inv2)%=mod;
    for(int i=0;i<(1<<n);++i) printf("%lld%c",(A[i]*pw%mod+mod)%mod," \n"[i+1==(1<<n)]);
    return 0;
}

詳細信息

Test #1:

score: 0
Wrong Answer
time: 28ms
memory: 6868kb

input:

17
12971 87517 21493 129172 55449 49056 84226 60548 107778 94553 94762 35834 62355 103942 1589 56049 64049 52657 13647 458 32499 10726 32746 16451 97495 80824 45233 13117 37142 117070 44795 1503 39107 17458 113346 77453 67829 98425 107567 67863 109865 88834 54880 108007 112287 6219 121301 115460 114...

output:

299431646 118812949 940656809 118136713 327769505 823029649 834467024 311607284 309250406 588893330 983341877 717297891 598520052 727507934 374087171 605899596 116865978 977479849 384165519 564605499 427081784 41346433 902927495 342488368 608049971 345346681 804179367 960160874 386523307 363100018 3...

result:

wrong answer 1st numbers differ - expected: '698812707', found: '299431646'

Test #2:

score: 0
Wrong Answer
time: 25ms
memory: 6824kb

input:

17
60681 43091 80828 84253 116262 125738 38458 47302 7816 48510 1739 126330 56987 29628 19300 58590 58805 84834 37607 85108 42824 104724 53232 73419 88929 120013 17556 126592 77200 108866 80463 19973 54540 75236 4447 34141 55852 83199 35626 15859 34602 87863 95828 24276 46221 28871 102512 130109 952...

output:

341282814 806901477 832933993 713979967 996180842 605486261 707682666 151332550 178939122 858225890 901876993 271339888 969086948 8245469 270142515 332781575 710246611 184892045 24861233 144882956 471723430 66389938 916463797 801924253 226047930 530287217 618805118 534121523 231665841 637556394 3996...

result:

wrong answer 1st numbers differ - expected: '656961539', found: '341282814'

Test #3:

score: 0
Wrong Answer
time: 32ms
memory: 6940kb

input:

17
80123 95971 37761 56275 108050 26373 101243 111039 61518 53462 50199 89421 4407 130890 86035 19719 69203 123363 107339 118003 91310 73762 91912 103483 104511 19917 119315 124430 97370 54405 39124 104828 123881 85074 38405 69557 19382 128321 55962 38389 41105 43537 128932 29395 120164 27652 121841...

output:

215729046 938489363 840960079 594501306 296565304 803218904 732333984 382103397 876631111 632592022 675997421 872022852 962195766 400647311 575493686 962250834 310469922 387183094 304067269 86033516 659556692 891588182 33731147 211500910 754195973 761960680 560638343 518484043 74295506 235596505 348...

result:

wrong answer 1st numbers differ - expected: '782515307', found: '215729046'

Test #4:

score: 0
Wrong Answer
time: 28ms
memory: 10640kb

input:

17
108939 64572 52175 61053 115827 90090 90712 71972 57340 96612 130277 95021 31140 116050 43691 43802 52242 32913 63231 50123 11700 84047 77730 7205 3920 97931 75125 22985 7819 85108 121546 118894 104930 129850 8015 29275 103196 124506 38732 76256 59318 70181 19572 49661 38361 304 125641 52720 1057...

output:

37078959 738003655 297462844 531877857 779020313 404214179 251344363 647815285 372555860 710003944 692495589 679126779 541094514 40832132 364280896 835972892 897018453 622635400 285310254 323871749 151427189 16016690 282959954 741374624 641121099 533166257 496886681 578053122 335626543 391525085 312...

result:

wrong answer 1st numbers differ - expected: '961165394', found: '37078959'

Test #5:

score: 0
Wrong Answer
time: 31ms
memory: 7024kb

input:

17
31774 67725 65380 69381 126096 130251 17026 66144 86636 1003 38183 44160 72510 58745 102958 63604 117646 67739 41196 78052 55940 36095 12434 123628 37896 49214 34244 75942 21320 63455 66385 97929 104259 92206 78015 38177 97295 89357 41766 72056 46879 97478 100720 15389 12924 92934 47851 42725 853...

output:

782739888 58225184 311755586 585186083 136717781 989599405 188737342 927430654 381233040 382259564 852711729 831106945 964979493 848562079 414523617 585708822 180323580 438132265 841993607 33299171 943182973 977838942 413442615 650450979 131045802 302081155 100818493 258773281 629614528 347528056 17...

result:

wrong answer 1st numbers differ - expected: '215504465', found: '782739888'

Test #6:

score: 0
Wrong Answer
time: 31ms
memory: 7020kb

input:

17
128832 40041 41368 104210 74000 120943 91735 94779 127869 68612 110143 104621 92991 72979 122777 39422 128799 14898 105541 57692 101463 66816 115636 109294 83181 7187 79264 1928 102559 76557 23190 105321 63523 17794 6806 50895 77097 106912 45722 111347 6619 65559 109836 115427 4879 88308 87890 98...

output:

519105436 927923988 225224537 39168756 707209988 231976227 337890398 191743843 879936683 704264143 754801136 735363238 77366220 930484722 203983105 416973385 142228251 201224674 428422527 934408285 580004542 70888305 541656254 451873836 565770476 531756190 228966412 288098211 864583428 306635834 178...

result:

wrong answer 1st numbers differ - expected: '479138917', found: '519105436'

Test #7:

score: 0
Wrong Answer
time: 23ms
memory: 10404kb

input:

17
72783 6091 19840 63551 18810 111065 21841 38393 123524 57925 14635 31627 86050 58432 43867 5202 47233 106182 34732 90077 9315 127975 54930 104606 79356 37755 73553 112255 98273 54764 5292 60613 23374 113347 4995 114800 58352 85709 81020 19773 102919 31355 84369 103097 2001 37268 109920 95173 9404...

output:

226293644 496419283 789803409 868002257 356152370 964877731 685456393 571622410 579456961 389951808 354298741 142372859 602754906 129284496 178376414 462572662 20149401 848014223 145232238 249588897 49170681 813480987 318030645 743885469 653027387 612511988 447271858 813879912 950989807 705553977 17...

result:

wrong answer 1st numbers differ - expected: '771950709', found: '226293644'

Test #8:

score: 0
Wrong Answer
time: 27ms
memory: 10400kb

input:

17
46309 89219 114374 41892 49238 10478 107055 98444 47093 50979 97846 74576 92885 79209 118666 19635 3460 58696 23156 5848 12493 76587 64564 6789 3575 79063 101453 5388 61638 71697 19932 68093 48232 56859 121208 46261 6897 87013 9732 64635 66395 107851 392 33439 85489 6382 4671 9866 56412 20250 822...

output:

241105892 576286015 203188995 506222182 32107688 569034506 302445491 694604888 133566331 242814886 525852012 263502429 125609294 195358017 346784562 890752505 311850644 430984279 363500941 106187322 933220506 619086955 348426741 310524951 359464719 266618804 647268319 280643020 762538266 393748582 1...

result:

wrong answer 1st numbers differ - expected: '757138461', found: '241105892'

Test #9:

score: 0
Wrong Answer
time: 31ms
memory: 10828kb

input:

17
27754 86939 42679 63610 33946 125278 110623 12553 116511 44588 60498 37304 125848 56270 76687 65142 50934 72435 97308 50362 110254 39337 53832 77230 2666 119442 61718 104884 64126 39964 59510 52802 98741 98026 6032 2857 64718 69433 75089 125294 122386 19656 126033 63680 72188 36218 130484 49102 9...

output:

721257760 611932025 668712582 239460413 221392732 604795419 636139379 22866799 143029753 19958044 983296696 720386769 359657944 587082368 585181802 510986118 443278513 764836313 561339392 521751724 674706292 923638674 625279304 876619038 741808 972287026 663869165 764217595 444974463 382966407 58557...

result:

wrong answer 1st numbers differ - expected: '276986593', found: '721257760'

Test #10:

score: 0
Wrong Answer
time: 27ms
memory: 6940kb

input:

17
92675 49618 93296 44550 86315 1135 84572 125202 81170 10398 76335 103794 63635 74494 58874 87903 52174 110193 87955 33432 22146 73241 83004 52072 84882 21505 33617 5880 81903 31364 98529 93950 74497 44469 15897 59590 95509 71 125003 14795 122158 130832 80779 17994 110212 106866 80913 40081 106507...

output:

223746338 351263 165918702 813114080 803613187 580548354 304287737 623738192 658677434 462657542 938823992 292145548 180011873 908722174 497852121 813438182 154813061 192613020 930147973 669179830 739184622 112077860 981800798 509975003 758301833 130826361 74657755 972697430 608482837 130384057 9623...

result:

wrong answer 1st numbers differ - expected: '774498015', found: '223746338'