QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#92102 | #1004. 快速 XOR 卷积 | sssmzy# | 0 | 31ms | 6552kb | C++14 | 1.5kb | 2023-03-30 10:52:53 | 2023-03-30 10:53:05 |
Judging History
answer
#include<bits/stdc++.h>
#define dg(x) cerr<<"line: "<<__LINE__<<" "<<#x<<": "<<x<<endl
#define gc()(xS==xTT&&(xTT=(xS=xB)+fread(xB,1,1<<20,stdin),xS==xTT)?0:*xS++)
#define pc(x)(p3-obuf<1000000)?(*p3++=x):(fwrite(obuf,p3-obuf,1,stdout),p3=obuf,*p3++=x)
using namespace std;typedef long long ll;typedef double db;typedef long double ld;typedef unsigned long long ull;typedef unsigned int ui;char xch,xB[1<<20],*xS=xB,*xTT=xB,obuf[1000000],*p3=obuf;inline ll read(){char ch=gc();ll x=0,f=1;while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=gc();}while('0'<=ch&&ch<='9'){x=(x<<1)+(x<<3)+(ch^48);ch=gc();}return x*f;}static char cc[20];template<typename item>inline void pt( item x){ int len=0;if(!x)pc('0');if(x<0)x=-x,pc('-');while(x)cc[len++]=x%10+'0',x/=10;while(len--)pc(cc[len]);}inline void pS(string s){for(int i=0;i<s.length();i++)pc(s[i]);}inline ll read2(){char ch=gc();ll x=0,f=1;while(ch<'0'||ch>'1'){if(ch=='-')f=-1;ch=gc();}while('0'<=ch&&ch<='9'){x=(x<<1)+(ch^48);ch=gc();}return x*f;}
const int maxn=17,mod=998244353;
int n,a[1<<maxn],b[1<<maxn];
void FWT(int f[],int rev)
{
for(int i=0;i<n;i++)
for(int j=0;j<(1<<i);j++)
for(int k=0,gx,gy;k<(1<<n);k+=(1<<i+1))
gx=f[j+k],gy=f[(1<<i)+j+k],f[j+k]=1ll*(gx+gy)*rev%mod,f[(1<<i)+j+k]=1ll*(gx-gy)*rev%mod;
}
signed main()
{
n=read();
for(int i=0;i<(1<<n);i++)a[i]=read();
for(int i=0;i<(1<<n);i++)b[i]=read();
FWT(a,1),FWT(b,1);for(int i=0;i<(1<<n);i++)a[i]=1ll*a[i]*b[i]%mod;FWT(a,(mod+1)>>1);
for(int i=0;i<(1<<n);i++)pt(a[i]),pc(' ');
fwrite(obuf,p3-obuf,1,stdout);
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 0
Wrong Answer
time: 30ms
memory: 6432kb
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 879431404 57587544 -118136713 670474848 175214704 -834467024 686637069 -309250406 -588893330 14902476 280946462 399724301 270736419 -374087171 -605899596 -116865978 20764504 614078834 -564605499 571162569 956897920 -902927495 -342488368 390194382 -345346681 -804179367 38083479 611721046 -...
result:
wrong answer 1st numbers differ - expected: '698812707', found: '-299431646'
Test #2:
score: 0
Wrong Answer
time: 27ms
memory: 6428kb
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:
656961539 191342876 -832933993 284264386 2063511 -605486261 -707682666 -151332550 819305231 140018463 -901876993 -271339888 29157405 -8245469 -270142515 -332781575 287997742 813352308 -24861233 853361397 526520923 -66389938 81780556 196320100 -226047930 -530287217 -618805118 -534121523 766578512 360...
result:
wrong answer 3rd numbers differ - expected: '165310360', found: '-832933993'
Test #3:
score: 0
Wrong Answer
time: 31ms
memory: 6460kb
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:
782515307 59754990 -840960079 403743047 701679049 -803218904 -732333984 616140956 -876631111 365652331 -675997421 -872022852 36048587 597597042 422750667 35993519 687774431 611061259 -304067269 -86033516 338687661 106656171 964513206 -211500910 -754195973 -761960680 437606010 -518484043 -74295506 76...
result:
wrong answer 3rd numbers differ - expected: '157284274', found: '-840960079'
Test #4:
score: 0
Wrong Answer
time: 26ms
memory: 6520kb
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 260240698 -297462844 -531877857 219224040 594030174 -251344363 350429068 625688493 -710003944 305748764 319117574 -541094514 -40832132 633963457 162271461 -897018453 375608953 -285310254 -323871749 846817164 -16016690 715284399 -741374624 -641121099 -533166257 501357672 -578053122 66261781...
result:
wrong answer 1st numbers differ - expected: '961165394', found: '-37078959'
Test #5:
score: 0
Wrong Answer
time: 24ms
memory: 6432kb
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:
215504465 -58225184 -311755586 413058270 861526572 8644948 809507011 70813699 -381233040 -382259564 145532624 167137408 -964979493 -848562079 -414523617 412535531 -180323580 560112088 -841993607 964945182 -943182973 20405411 584801738 -650450979 867198551 696163198 -100818493 739471072 -629614528 65...
result:
wrong answer 2nd numbers differ - expected: '940019169', found: '-58225184'
Test #6:
score: 0
Wrong Answer
time: 25ms
memory: 6428kb
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 70320365 -225224537 -39168756 291034365 -231976227 660353955 -191743843 -879936683 -704264143 -754801136 -735363238 -77366220 -930484722 -203983105 581270968 -142228251 797019679 -428422527 63836068 -580004542 927356048 -541656254 546370517 -565770476 -531756190 -228966412 710146142 -8645...
result:
wrong answer 1st numbers differ - expected: '479138917', found: '-519105436'
Test #7:
score: 0
Wrong Answer
time: 23ms
memory: 6436kb
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 130242096 642091983 33366622 -685456393 -571622410 418787392 608292545 -354298741 -142372859 -602754906 868959857 -178376414 535671691 -20149401 -848014223 -145232238 -249588897 -49170681 184763366 680213708 -743885469 -653027387 -612511988 -447271858 184364441 47254...
result:
wrong answer 1st numbers differ - expected: '771950709', found: '-226293644'
Test #8:
score: 0
Wrong Answer
time: 23ms
memory: 6552kb
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 795055358 -506222182 966136665 -569034506 695798862 303639465 864678022 -242814886 472392341 734741924 872635059 -195358017 651459791 107491848 686393709 -430984279 -363500941 892057031 -933220506 -619086955 -348426741 -310524951 638779634 -266618804 350976034 -280643020 235706...
result:
wrong answer 1st numbers differ - expected: '757138461', found: '-241105892'
Test #9:
score: 0
Wrong Answer
time: 24ms
memory: 6460kb
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 776851621 -604795419 -636139379 -22866799 -143029753 -19958044 14947657 -720386769 638586409 411161985 -585181802 -510986118 -443278513 233408040 -561339392 -521751724 -674706292 -923638674 372965049 121625315 997502545 25957327 -663869165 234026758 -44497...
result:
wrong answer 1st numbers differ - expected: '276986593', found: '-721257760'
Test #10:
score: 0
Wrong Answer
time: 29ms
memory: 6544kb
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:
774498015 -351263 832325651 185130273 194631166 417695999 -304287737 -623738192 -658677434 535586811 -938823992 706098805 818232480 -908722174 500392232 184806171 -154813061 805631333 -930147973 -669179830 259059731 -112077860 16443555 -509975003 239942520 867417992 -74657755 -972697430 -608482837 8...
result:
wrong answer 2nd numbers differ - expected: '997893090', found: '-351263'