QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#786625#1004. 快速 XOR 卷积dongyc6660 25ms10512kbC++17760b2024-11-26 22:30:032024-11-26 22:30:03

Judging History

This is the latest submission verdict.

  • [2024-11-26 22:30:03]
  • Judged
  • Verdict: 0
  • Time: 25ms
  • Memory: 10512kb
  • [2024-11-26 22:30:03]
  • Submitted

answer

#include<bits/stdc++.h>
using namespace std;
const int NR=(1<<20)+10;
const int MOD=998244353;
const int Inv2=499122177;
#define int long long
int n,a[NR],b[NR];

void FWT(int *f,int x){
	for(int len=1;len<(1<<n);len<<=1)
		for(int i=0;i<(1<<n);i+=len*2)
			for(int j=0;j<len;j++){
				int v1=f[i+j],v2=f[i+j+len];
				if(x==1)f[i+j]=(v1+v2),f[i+j+len]=(v1-v2+MOD)%MOD;
				else f[i+j]=(v1+v2)*Inv2%MOD,f[i+j+len]=(v1-v2+MOD)*Inv2%MOD;
			}
}

signed main(){
	ios::sync_with_stdio(false);
	cin.tie(0);cout.tie(0);
	cin>>n;
	for(int i=0;i<(1<<n);i++)cin>>a[i];
	for(int i=0;i<(1<<n);i++)cin>>b[i];
	FWT(a,1);FWT(b,1);
	for(int i=0;i<(1<<n);i++)a[i]=a[i]*b[i]%MOD;
	FWT(a,-1);
	for(int i=0;i<(1<<n);i++)cout<<a[i]<<' ';
	return 0;
} 

詳細信息


Pretests


Final Tests

Test #1:

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

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:

125833847 641527073 494073176 250265025 867491147 257628705 202684893 796261188 543907153 623303882 154473660 119244796 523287066 733598589 346694430 495906658 184263386 198484085 865380671 343416454 14472920 799073529 380736759 433783424 899559784 269920047 938814339 938562913 741064189 825693994 7...

result:

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

Test #2:

score: 0
Wrong Answer
time: 20ms
memory: 10288kb

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:

954353646 930605647 903574445 961282302 832948418 268417500 589798088 116476721 40279360 727581566 21359384 296062389 587095020 169826929 867179339 395696363 235748205 105686029 278675593 793591753 821803700 780233304 208239886 150014839 932905927 511600119 220474712 400194283 900503700 5907554 1974...

result:

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

Test #3:

score: 0
Wrong Answer
time: 22ms
memory: 6648kb

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:

357429695 450502895 779517611 54531099 282731824 709417552 162563969 302810121 92275092 385398389 503690576 711740381 282268326 659638896 849225975 828267232 604931110 267629825 510258157 309225973 594635590 644804311 457949730 383887190 144781466 19245456 149499117 595094236 82610218 700058986 1560...

result:

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

Test #4:

score: 0
Wrong Answer
time: 24ms
memory: 6720kb

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:

372960134 112214350 852336455 658254970 753617437 130691205 767972969 372571946 661132992 498104730 348886220 885814909 918653682 884178914 14682576 594257897 616159025 360954537 912846923 19082260 810009714 778301174 594033071 757656781 921049858 60670783 292766429 542574359 364353427 901456861 985...

result:

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

Test #5:

score: 0
Wrong Answer
time: 24ms
memory: 10068kb

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:

521003223 571139788 637492560 76534916 831416017 775823155 701226235 280255138 982360744 230962843 659137046 179763639 106425506 100768912 157659804 292777116 508655578 274554953 29078374 346592894 816017631 184661281 663396637 731985796 976589487 197577873 854280512 16931010 277472428 822303527 242...

result:

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

Test #6:

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

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:

387412372 797176508 452134020 86597732 512370557 890202228 994554620 610328103 389056135 123185023 469226732 447297607 -863720695 387381081 597018970 271394280 971679687 566728712 769382193 96341069 326941668 976991116 855571407 168750476 304728021 673532836 650776104 859104943 686593533 297775356 3...

result:

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

Test #7:

score: 0
Wrong Answer
time: 24ms
memory: 10020kb

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:

30988260 557522006 626598538 892837900 553825137 531192894 986198551 213460897 733170762 427205386 306000584 777985383 584116825 911545679 415095747 947426806 133157228 647844671 239934880 227371375 992980189 239544313 500876522 475713698 788248953 249407993 125546298 215459788 841835480 579673745 1...

result:

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

Test #8:

score: 0
Wrong Answer
time: 20ms
memory: 9980kb

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:

766850627 863954232 99360933 234379924 697127021 822284335 755854182 838897306 521013803 721953636 214808783 10510006 585226550 857455954 773196110 620685668 141894985 589191237 173859522 273634246 926643390 868877173 852408830 558444476 871038973 586771606 323550513 615747784 103169595 162798185 84...

result:

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

Test #9:

score: 0
Wrong Answer
time: 18ms
memory: 6656kb

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:

810317161 374547895 695313486 469561031 1353374 677753437 676920254 366260051 898977267 462994137 184619186 22048345 111009979 671851613 302244157 452795752 86599094 511720354 987024587 34301078 714831654 956404706 848926239 954220568 622539528 827042221 442436291 945233741 365678803 946037160 74496...

result:

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

Test #10:

score: 0
Wrong Answer
time: 16ms
memory: 6768kb

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:

512673137 829212401 886177955 848613621 438031555 414955036 203394937 157045064 497386462 424569208 503096183 187705031 700076504 319336119 585754351 559905212 492928028 701944830 372338068 953706600 567806591 578404531 705433001 100216457 973121673 426636495 701249252 254232755 277103946 179720878 ...

result:

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