正文
增加 19 行删除 7 行
116 行未改动全部展开11711811912012112212312495 行未改动2202212222232242252262272282292303 行未改动2342352362372382392402412422432443 行未改动2482492502512522532542552562572585 行未改动26426526626726826927027135 行未改动3073083093103113123133143153163172 行未改动32032132232332432532632721 行未改动3493503513523533543553562 行未改动359360361362363364365366367368369370371372373374375376377116 行未改动全部展开void clear(){n = l = 0;lim = 1;}void FWT_or(LL A[],int type){for(int mid = 1; mid < lim; mid <<= 1)95 行未改动{static fwt_base fwt;fwt.clear();fwt.n = a.n + 1;fwt.lim = fwt.n * 2;for(int i = 0; i < fwt.n; i ++) fwt.a[i] = a.a[i];for(int i = 0; i < fwt.n; i ++) fwt.b[i] = b.a[i];fwt.FWT_or(fwt.a,1),fwt.FWT_or(fwt.b,1);for(int i = 0; i < fwt.lim; i ++) fwt.a[i] = fwt.a[i] * fwt.b[i] % mod;fwt.FWT_or(fwt.a,-1);c.n = fwt.n - 1;3 行未改动{static fwt_base fwt;fwt.clear();fwt.n = a.n + 1;fwt.lim = fwt.n * 2;for(int i = 0; i < fwt.n; i ++) fwt.a[i] = a.a[i];for(int i = 0; i < fwt.n; i ++) fwt.b[i] = b.a[i];fwt.FWT_and(fwt.a,1),fwt.FWT_and(fwt.b,1);for(int i = 0; i < fwt.lim; i ++) fwt.a[i] = fwt.a[i] * fwt.b[i] % mod;fwt.FWT_and(fwt.a,-1);c.n = fwt.n - 1;3 行未改动{static fwt_base fwt;fwt.clear();fwt.n = a.n + 1;fwt.lim = fwt.n * 2;for(int i = 0; i < fwt.n; i ++) fwt.a[i] = a.a[i];for(int i = 0; i < fwt.n; i ++) fwt.b[i] = b.a[i];fwt.FWT_xor(fwt.a,1),fwt.FWT_xor(fwt.b,1);for(int i = 0; i < fwt.lim; i ++) fwt.a[i] = fwt.a[i] * fwt.b[i] % mod;fwt.FWT_xor(fwt.a,half);c.n = fwt.n - 1;5 行未改动ntt.clear();if(n == 1){b.a[0] = qmi(a.a[0],mod - 2);return;}inv(a,n + 1 >> 1,b);ntt.n = n,ntt.m = n;35 行未改动{b.a[0] = 1;LL res = quad_residue::get(a.a[0],mod);b.a[0] = min(res,mod - res);return;}sqrt(a,n + 1 >> 1,b);tmp.n = tmp2.n = n;for(int i = 0; i < n; i ++) tmp.a[i] = b.a[i] * 2 % mod;inv(tmp,n,tmp2);b.n = n;2 行未改动b.n = n;for(int i = 0; i < n; i ++) b.a[i] = (b.a[i] + a.a[i]) % mod;mul(b,tmp2,tmp3);for(int i = 0; i < n; i ++) b.a[i] = tmp3.a[i];}friend void diff(const poly &a,poly &b){b.n = a.n - 1;21 行未改动static poly tmp,tmp2;if(n == 1){b.a[0] = 1;return;}exp(a,n + 1 >> 1,b);tmp.n = tmp2.n = n;2 行未改动tmp2 = a - tmp;tmp.n = tmp2.n = n;mul(tmp2,b,tmp);for(int i = 0; i < n; i ++) b.a[i] = tmp.a[i];}friend void qmi(const poly &a,const LL &k,poly &b){static poly tmp;tmp.clear();ln(a,a.n + 1,tmp);for(int i = 0; i <= tmp.n; i ++) tmp.a[i] = tmp.a[i] * k % mod;int cnt = 1;while(cnt <= tmp.n) cnt <<= 1;b.n = a.n;exp(tmp,cnt,b);}};}```116 行未改动全部展开11711811912012112212312412512695 行未改动2222232242252262272282292302312322332343 行未改动2382392402412422432442452462472482492503 行未改动2542552562572582592602612622632642652665 行未改动27227327427527627727827928035 行未改动3163173183193203213223233243253263273283292 行未改动33233333433533633733833934021 行未改动3623633643653663673683693702 行未改动373374375376377378379380381382383384385386387388389116 行未改动全部展开void clear(){n = l = 0;lim = 1;memset(a,0,sizeof a);memset(b,0,sizeof b);}void FWT_or(LL A[],int type){for(int mid = 1; mid < lim; mid <<= 1)95 行未改动{static fwt_base fwt;fwt.clear();fwt.n = a.n + 1;fwt.lim = 1;while(fwt.lim < fwt.n) fwt.lim <<= 1;for(int i = 0; i < fwt.n; i ++) fwt.a[i] = a.a[i];for(int i = 0; i < fwt.n; i ++) fwt.b[i] = b.a[i];for(int i = fwt.n; i < fwt.lim; i ++) fwt.a[i] = fwt.b[i] = 0;fwt.FWT_or(fwt.a,1),fwt.FWT_or(fwt.b,1);for(int i = 0; i < fwt.lim; i ++) fwt.a[i] = fwt.a[i] * fwt.b[i] % mod;fwt.FWT_or(fwt.a,-1);c.n = fwt.n - 1;3 行未改动{static fwt_base fwt;fwt.clear();fwt.n = a.n + 1;fwt.lim = 1;while(fwt.lim < fwt.n) fwt.lim <<= 1;for(int i = 0; i < fwt.n; i ++) fwt.a[i] = a.a[i];for(int i = 0; i < fwt.n; i ++) fwt.b[i] = b.a[i];for(int i = fwt.n; i < fwt.lim; i ++) fwt.a[i] = fwt.b[i] = 0;fwt.FWT_and(fwt.a,1),fwt.FWT_and(fwt.b,1);for(int i = 0; i < fwt.lim; i ++) fwt.a[i] = fwt.a[i] * fwt.b[i] % mod;fwt.FWT_and(fwt.a,-1);c.n = fwt.n - 1;3 行未改动{static fwt_base fwt;fwt.clear();fwt.n = a.n + 1;fwt.lim = 1;while(fwt.lim < fwt.n) fwt.lim <<= 1;for(int i = 0; i < fwt.n; i ++) fwt.a[i] = a.a[i];for(int i = 0; i < fwt.n; i ++) fwt.b[i] = b.a[i];for(int i = fwt.n; i < fwt.lim; i ++) fwt.a[i] = fwt.b[i] = 0;fwt.FWT_xor(fwt.a,1),fwt.FWT_xor(fwt.b,1);for(int i = 0; i < fwt.lim; i ++) fwt.a[i] = fwt.a[i] * fwt.b[i] % mod;fwt.FWT_xor(fwt.a,half);c.n = fwt.n - 1;5 行未改动ntt.clear();if(n == 1){b.a[0] = qmi(a.a[0],mod - 2);b.n = 0;return;}inv(a,n + 1 >> 1,b);ntt.n = n,ntt.m = n;35 行未改动{b.a[0] = 1;LL res = quad_residue::get(a.a[0],mod);b.a[0] = min(res,mod - res);b.n = 0;return;}sqrt(a,n + 1 >> 1,b);for(int i = (n + 1 >> 1); i < n; i ++) b.a[i] = 0;b.n = n - 1;tmp.n = tmp2.n = n;for(int i = 0; i < n; i ++) tmp.a[i] = b.a[i] * 2 % mod;inv(tmp,n,tmp2);b.n = n;2 行未改动b.n = n;for(int i = 0; i < n; i ++) b.a[i] = (b.a[i] + a.a[i]) % mod;mul(b,tmp2,tmp3);for(int i = 0; i < n; i ++) b.a[i] = tmp3.a[i];b.n = n - 1;}friend void diff(const poly &a,poly &b){b.n = a.n - 1;21 行未改动static poly tmp,tmp2;if(n == 1){b.a[0] = 1;b.n = 0;return;}exp(a,n + 1 >> 1,b);tmp.n = tmp2.n = n;2 行未改动tmp2 = a - tmp;tmp.n = tmp2.n = n;mul(tmp2,b,tmp);for(int i = 0; i < n; i ++) b.a[i] = tmp.a[i];b.n = n - 1;}friend void qmi(const poly &a,const LL &k,poly &b){static poly tmp;tmp.clear();ln(a,a.n + 1,tmp);for(int i = 0; i <= tmp.n; i ++) tmp.a[i] = tmp.a[i] * k % mod;b.n = a.n;exp(tmp,a.n + 1,b);}};}