摘要: 快速傅里叶(FFT)+推式子 #include<bits/stdc++.h> using namespace std; const int N=4e6; //2^22=4194304 const double PI=acos(-1.0); typedef complex<double> Comple 阅读全文
posted @ 2026-03-28 00:28 huangguougo 阅读(3) 评论(0) 推荐(0)
摘要: 快速傅里叶变换(FFT) #include <bits/stdc++.h> using namespace std; const int N=4e6; //2^22=4194304 const double PI=acos(-1.0); typedef complex<double> Complex 阅读全文
posted @ 2026-03-27 23:28 huangguougo 阅读(2) 评论(0) 推荐(0)
摘要: #include <bits/stdc++.h> #define int long long using namespace std; const int P=998244353, N=1<<22; int qpow(int a, int b) { //快速幂 int res=1; while(b) 阅读全文
posted @ 2026-03-24 01:52 huangguougo 阅读(3) 评论(0) 推荐(0)
摘要: // 树的直径 正边权 两次DFS O(n) #include<bits/stdc++.h> using namespace std; const int N=100005; int n, p, mxd, d[N]; vector<pair<int, int>> e[N]; void dfs(int 阅读全文
posted @ 2026-03-18 00:44 huangguougo 阅读(6) 评论(0) 推荐(0)
摘要: // spfa算法 O(m~nm) #include<bits/stdc++.h> #define INF 0X3F3F3F3F using namespace std; const int N=1e4+5; struct node { int v, w; }; vector<node> e[N]; 阅读全文
posted @ 2026-03-12 20:13 huangguougo 阅读(5) 评论(0) 推荐(0)
摘要: // 分层图最短路 Dijkstra 算法 O(nk*log(nk)) #include <bits/stdc++.h> #define LL long long #define PLI pair<LL, int> using namespace std; const int N=10005, M= 阅读全文
posted @ 2026-03-12 12:46 huangguougo 阅读(6) 评论(0) 推荐(0)
摘要: // 最短路 Floyd 算法 O(n^3) #include<bits/stdc++.h> using namespace std; #define PDD pair<double, double> #define x first #define y second const int N=155; 阅读全文
posted @ 2026-03-12 12:44 huangguougo 阅读(6) 评论(0) 推荐(0)
摘要: //负权多源最短路 约翰逊算法 (nmlogn) #include<bits/stdc++.h> #define INF 1000000000 #define LL long long using namespace std; const int N=30005; int n, m; struct 阅读全文
posted @ 2026-03-11 12:58 huangguougo 阅读(9) 评论(0) 推荐(0)
摘要: // Floyd 算法 O(n^3) #include<bits/stdc++.h> using namespace std; const int N=105; int n, m, a, b, c; int d[N][N]; void floyd() { for(int k=1; k <= n; k 阅读全文
posted @ 2026-03-11 12:57 huangguougo 阅读(7) 评论(0) 推荐(0)
摘要: // spfa算法 O(m~nm) #include<bits/stdc++.h> #define INF 0X3F3F3F3F using namespace std; const int N=505; struct node { int v, w; }; vector<node> e[N]; i 阅读全文
posted @ 2026-03-11 09:33 huangguougo 阅读(8) 评论(0) 推荐(0)