原创 KM 二分圖匹配
#include<bits/stdc++.h> using namespace std; const int MAXN = 505; const int INF = 0x3f3f3f3f; int N; int a[MAXN
原创 凸包 極角排序
const int maxn=1005; const double eps=1e-10; struct point{ int x; int y; point(){} point(int xx,i
原创 kd-tree
#include<bits/stdc++.h> #define alpha (1.130/2) #define INF 0x3f3f3f3f using namespace std; typedef long long ll;
原创 等差數列除以一個數字求和(2019牛客暑期多校訓練營(第九場)I題)
??神仙算法,類歐幾里得的另一種用法 首先對於一個a爲公差,b爲首項,n爲項數的等差數列,我們以c爲除數 我們先考慮首項的貢獻,很明顯爲b/c*n(還用你說 )。 然後對於公差a,我們一共也是計算了(n-1)n次(1到n-1等差數
原创 2進制trie樹
#include<cstdlib> #include<cstdio> #include<cstring> #include<iostream> #include<vector> using namespace std; const
原创 trie樹
#include<cstdlib> #include<cstdio> #include<iostream> #include<cstring> using namespace std; const int maxn=50000*5
原创 數學模板
#include<bits/stdc++.h> using namespace std; typedef long long ll; const int maxn=100005; const ll mod=100000007;
原创 求區間內最大(最小)子區間的線段樹
#include<bits/stdc++.h> using namespace std; typedef long long ll; struct shu { int l,r; ll w,lw,rw,ww; }w
原创 最小割樹
#include<bits/stdc++.h> using namespace std; typedef long long ll; const int maxn=1005; const ll inf=2000000000000
原创 匈牙利算法
#include<bits/stdc++.h> using namespace std; const int maxn=1010005; struct edge { int v,next; }e[maxn*10]; i
原创 中國剩餘定理
#include<iostream> #include<cstdlib> #include<cstdio> #include<algorithm> #include<cmath> using namespace std; typ
原创 主席樹(可持久化線段樹)
#include<iostream> #include<algorithm> #include<cmath> #include<cstdlib> #include<cstdio> using namespace std; con
原创 最小表示法
#include<bits/stdc++.h> using namespace std; char a[105],b[105]; int n; set<string>q; int getmin() { int
原创 最短路徑樹
#include<iostream> #include<cstdio> #include<vector> #include<cstdlib> #include<queue> using namespace std; const i
原创 支配樹
#include<bits/stdc++.h> using namespace std; const int N = 200010; struct Node{int to,next;};//邊 int n,m,dfn[N],