
数论 多项式类
csu_xiji
这个作者很懒,什么都没留下…
展开
-
codeforces 662C Binary Table FWT
https://codeforces.com/problemset/problem/662/C题目大意:给一个n∗mn*mn∗m的010101矩阵,每次操作可以选择任意一行或一列翻转,问经过若干次操作后这个矩阵最少还剩下多少111。思路:首先想一下暴力的做法,O(2n)O(2^n)O(2n)枚举行的翻转情况,那么每一列要么翻转要么不翻转,两种情况取最小值然后累加起来即可,时间复杂度O(2nm...原创 2020-01-14 22:49:06 · 243 阅读 · 0 评论 -
BZOJ 4589 Hard Nim 博弈论+FWT
https://www.lydsy.com/JudgeOnline/problem.php?id=4589思路:NimNimNim博弈先手必败的条件是nnn堆石子的异或和为000,所以本题就是求nnn个<=m<=m<=m的异或和为000的质数的方案数。显然可以dpdpdp,设dp[i][j]dp[i][j]dp[i][j]表示前iii堆石子异或和为jjj的方案数,则dp[i]...原创 2020-01-14 17:20:59 · 212 阅读 · 0 评论 -
HDU 6057 Kanade's convolution FWT+数学 好题
http://acm.hdu.edu.cn/showproblem.php?pid=6057题目大意:思路:好题,当然也是难题,我们来慢慢分析。考虑对原式子进行变形,设p=i xor j,q=i or jp=i\ xor\ j,q=i\ or\ jp=i xor j,q=i or j,由位运算关系不难得到i&...原创 2020-01-14 15:52:52 · 248 阅读 · 0 评论 -
HDU 5909 Tree Cutting 树形dp+FWT
http://acm.hdu.edu.cn/showproblem.php?pid=5909题目大意:⼀棵NNN个节点的树,每个节点有⼀个权值viv_ivi,⼦树的权值定义为子树内所有节点权值的异或和。问各个权值的子树分别有多少种?思路:设dp[u][i]dp[u][i]dp[u][i]表示以uuu为根的且权值为iii的子树的个数,初始时dp[i][a[i]]=1dp[i][a[i]]=...原创 2020-01-14 13:17:07 · 244 阅读 · 0 评论 -
洛谷 P4717 【模板】快速沃尔什变换 (FWT)
https://www.luogu.com.cn/problem/P4717#include<bits/stdc++.h>using namespace std; //FWTtypedef long long ll;const int maxn=1e6+5;const int MOD=998244353;int n,limit;ll a[maxn<...原创 2020-01-14 11:26:54 · 195 阅读 · 0 评论 -
洛谷 P4238 【模板】多项式乘法逆
https://www.luogu.com.cn/problem/P4238#include<bits/stdc++.h>using namespace std; //NTT模板typedef long long ll;const int maxn=1e5+5;const int MOD=998244353; //模数const int G=3; //原根...原创 2020-01-13 22:07:14 · 301 阅读 · 0 评论 -
洛谷 P4245 【模板】任意模数NTT
https://www.luogu.com.cn/problem/P4245#include<bits/stdc++.h>using namespace std; //FFT模板typedef long long ll;const int maxn=1e5+5;int idx=0;//次数int n,m,realmod;int limit,bit,le...原创 2020-01-13 18:58:42 · 196 阅读 · 0 评论 -
UVA12633 Super Rooks on Chessboard FFT
https://onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&problem=4358题目大意:TTT组数据,每组数据有一个n∗mn*mn∗m的矩阵,上面有numnumnum个超级车,每个超级车可以攻击同一行、同一列、同一主对角线上的任意方块,问这个矩阵中有多少个方...原创 2020-01-12 19:38:52 · 313 阅读 · 0 评论 -
HDU 4609 3-idiots FFT
http://acm.hdu.edu.cn/showproblem.php?pid=4609King OMeGa catched three men who had been streaking in the street. Looking as idiots though, the three men insisted that it was a kind of performance art...原创 2020-01-12 18:10:51 · 221 阅读 · 0 评论 -
Kattis - aplusb A+B Problem 2016年ACM香港网络赛 FFT
https://open.kattis.com/problems/aplusbGiven N integers in the range [−50000,50000], how many ways are there to pick three integers ai, aj, ak, such that i, j, k are pairwise distinct and ai+aj=ak? T...转载 2020-01-12 16:39:53 · 293 阅读 · 0 评论 -
HDU 1402 A * B Problem Plus FFT
http://acm.hdu.edu.cn/showproblem.php?pid=1402Calculate A * B.InputEach line will contain two integers A and B. Process to end of file.Note: the length of each integer will not exceed 50000.Outpu...原创 2020-01-12 12:16:12 · 179 阅读 · 1 评论 -
洛谷 P3803 模板】多项式乘法 FFT
https://www.luogu.com.cn/problem/P3803题目背景这是一道多项式乘法模板题题目描述给定一个 n 次多项式 F(x),和一个 m 次多项式 G(x)。请求出 F(x) 和 G(x) 的卷积。输入格式第一行两个整数 n,mn,m。接下来一行 n+1 个数字,从低到高表示 F(x)F(x) 的系数。接下来一行 m+1 个数字,从低到高表示 G(x)G(...原创 2020-01-12 12:12:18 · 214 阅读 · 0 评论 -
洛谷 P1919 模板】A*B Problem升级版(FFT快速傅里叶)
https://www.luogu.com.cn/problem/P1919题目背景本题数据已加强,请使用 FFT/NTT,不要再交 Python 代码浪费评测资源。题目描述给你两个正整数 a,ba,b,求 a \times ba×b。输入格式第一行一个正整数,表示 aa;第二行一个正整数,表示 bb。输出格式输出一行一个整数表示答案。输入输出样例输入 #1复制114514...原创 2020-01-12 12:10:24 · 566 阅读 · 1 评论 -
多项式类数学相关 FFT&NTT&FWT
推荐博客:FFTFFTFFT快速傅里叶变换:https://www.cnblogs.com/pks-t/p/9251147.html快速傅里叶变换&快速数论变换&快速沃尔什变换:https://www.cnblogs.com/NaVi-Awson/p/8684389.html模板:看懂是不可能看懂的,只能抄抄模板混混日子。tips1:tips1:tips1:一定要注意数组...原创 2020-01-13 19:02:25 · 327 阅读 · 0 评论