QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#793516#1004. 快速 XOR 卷积zhulexuan0 21ms5760kbC++141.8kb2024-11-29 20:43:552024-11-29 20:43:55

Judging History

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

  • [2024-11-29 20:43:55]
  • 评测
  • 测评结果:0
  • 用时:21ms
  • 内存:5760kb
  • [2024-11-29 20:43:55]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define inf INT_MAX
#define fr(i,l,r) for (i=(l); i<=(r); i++)
#define rfr(i,l,r) for (i=(l); i>=(r); i--)
template<typename T>inline void read(T &n){
    T w=1; n=0; char ch=getchar();
    while (!isdigit(ch) && ch!=EOF){ if (ch=='-') w=-1; ch=getchar(); }
    while (isdigit(ch) && ch!=EOF){ n=(n<<3)+(n<<1)+(ch&15); ch=getchar(); }
    n*=w;
}
template<typename T>inline void write(T x){
    if (x==0){ putchar('0'); return ; }
    T tmp;
    if (x>0) tmp=x;
    else tmp=-x;
    if (x<0) putchar('-');
    char F[105];
    long long cnt=0;
    while (tmp){
        F[++cnt]=tmp%10+48;
        tmp/=10;
    }
    while (cnt) putchar(F[cnt--]);
}
#define Min(x,y) x = min(x,y)
#define Max(x,y) x = max(x,y)
//基础配置=================================================================================
const ll N = (1<<17)+5, mod = 998244353;
ll pw(ll x,ll y){
    ll ans = 1;
    while (y){
        if (y&1) ans = ans*x %mod;
        x = x*x %mod;
        y >>= 1;
    }
    return ans;
}
ll n,m;
ll a[N],b[N];
void Xor(ll n,ll *a,ll v){
    ll len,i,j;
    for (len=1; len<n; len<<=1)
        for (i=0; i<n; i+=len<<1)
            fr(j,0,len-1){
                ll x = a[i|j], y = a[i|j|len];
                ( a[i|j] = x+y ) %=mod;
                ( a[i|j|len] = x-y ) %=mod;
            }
    if (v==-1){
        ll x = pw(n,mod-2);
        fr(i,0,n-1) a[i] = a[i]*x %mod;
    }
}
int main(){
//	freopen(".in","r",stdin);
//	freopen(".out","w",stdout);
    ll i,j;
    read(n); n = 1<<n;
    fr(i,0,n-1) read(a[i]);
    fr(i,0,n-1) read(b[i]);
    Xor(n,a,1);
    Xor(n,b,1);
    fr(i,0,n-1) a[i] = a[i]*b[i] %mod;
    Xor(n,a,-1);
    fr(i,0,n-1) write(a[i]), putchar(' ');
    return 0;
}
//g++ a.cpp -o a -Wall -Wl,--stack=512000000 -std=c++11 -O2

詳細信息


Pretests


Final Tests

Test #1:

score: 0
Wrong Answer
time: 21ms
memory: 5552kb

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 163777329 -311607284 -309250406 -588893330 14902476 -717297891 -598520052 270736419 -374087171 392344757 881378375 20764504 -384165519 433638854 571162569 -41346433 95316858 -342488368 -608049971 652897672 -804179367 -960160874 -386523307 ...

result:

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

Test #2:

score: 0
Wrong Answer
time: 13ms
memory: 5676kb

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 191342876 -832933993 284264386 -996180842 392758092 290561687 846911803 -178939122 140018463 -901876993 726904465 29157405 989998884 -270142515 -332781575 287997742 -184892045 973383120 853361397 -471723430 -66389938 -916463797 -801924253 772196423 -530287217 -618805118 464122830 76657851...

result:

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

Test #3:

score: 0
Wrong Answer
time: 21ms
memory: 5736kb

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 121613242 365652331 -675997421 -872022852 -962195766 -400647311 422750667 -962250834 687774431 -387183094 694177084 -86033516 338687661 -891588182 964513206 786743443 -754195973 236283673 437606010 -518484043 -74295506...

result:

wrong answer 3rd numbers differ - expected: '157284274', found: '-840960079'

Test #4:

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

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:

961165394 260240698 -297462844 466366496 -779020313 594030174 -251344363 350429068 625688493 -710003944 -692495589 -679126779 -541094514 -40832132 633963457 -835972892 101225900 375608953 712934099 674372604 -151427189 -16016690 -282959954 256869729 -641121099 -533166257 501357672 420191231 -3356265...

result:

wrong answer 3rd numbers differ - expected: '700781509', found: '-297462844'

Test #5:

score: 0
Wrong Answer
time: 21ms
memory: 5576kb

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 686488767 413058270 -136717781 8644948 -188737342 -927430654 -381233040 615984789 -852711729 167137408 -964979493 149682274 583720736 -585708822 -180323580 560112088 156250746 -33299171 55061380 -977838942 -413442615 347793374 867198551 696163198 897425860 739471072 -629614528 -...

result:

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

Test #6:

score: 0
Wrong Answer
time: 21ms
memory: 5684kb

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:

479138917 -927923988 -225224537 959075597 291034365 -231976227 660353955 -191743843 118307670 -704264143 243443217 262881115 920878133 67759631 -203983105 581270968 856016102 -201224674 569821826 -934408285 -580004542 927356048 456588099 -451873836 -565770476 -531756190 -228966412 -288098211 1336609...

result:

wrong answer 2nd numbers differ - expected: '70320365', found: '-927923988'

Test #7:

score: 0
Wrong Answer
time: 21ms
memory: 5736kb

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 312787960 -571622410 418787392 608292545 643945612 -142372859 395489447 -129284496 819867939 535671691 978094952 150230130 -145232238 -249588897 -49170681 184763366 -318030645 254358884 -653027387 385732365 550972495 184364441 47254546 -7...

result:

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

Test #8:

score: 0
Wrong Answer
time: 21ms
memory: 5740kb

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:

757138461 421958338 795055358 492022171 -32107688 -569034506 695798862 -694604888 -133566331 755429467 472392341 734741924 -125609294 -195358017 651459791 -890752505 686393709 567260074 -363500941 -106187322 -933220506 379157398 649817612 -310524951 638779634 731625549 350976034 -280643020 -76253826...

result:

wrong answer 5th numbers differ - expected: '966136665', found: '-32107688'

Test #9:

score: 0
Wrong Answer
time: 12ms
memory: 5760kb

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:

276986593 386312328 329531771 758783940 -221392732 -604795419 -636139379 -22866799 855214600 -19958044 -983296696 277857584 638586409 411161985 413062551 487258235 554965840 233408040 -561339392 -521751724 -674706292 -923638674 -625279304 -876619038 -741808 25957327 334375188 -764217595 -444974463 -...

result:

wrong answer 5th numbers differ - expected: '776851621', found: '-221392732'

Test #10:

score: 0
Wrong Answer
time: 17ms
memory: 5596kb

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 -165918702 185130273 194631166 -580548354 693956616 374506161 339566919 535586811 59420361 706098805 -180011873 89522179 500392232 184806171 -154813061 805631333 -930147973 -669179830 259059731 -112077860 16443555 -509975003 239942520 867417992 923586598 -972697430 -608482837 86786...

result:

wrong answer 2nd numbers differ - expected: '997893090', found: '-351263'