摘要:
1 for (int i=1;i d[l]) { 23 d[++l] = b[i]; 24 } else { 25 int k = lower_bound(d + 1, d + l + 1, b[i]) - d; 26 d[k] = b[i]; 27 } 28 } 29 pr... 阅读全文
posted @ 2019-07-15 22:06
Snow_in_winer
阅读(137)
评论(0)
推荐(0)
摘要:
1 struct node { 2 int u, v, w; 3 4 bool operator<(const node &b) const { 5 return w < b.w; 6 } 7 }a[M]; 8 9 int find(int x) { 10 if (x == f[x]) { 11 return ... 阅读全文
posted @ 2019-07-15 22:06
Snow_in_winer
阅读(144)
评论(0)
推荐(0)
摘要:
1 #include<cstring> 2 #include<stack> 3 #include<cstdio> 4 using namespace std; 5 6 const int N=400010; 7 char c[N]; 8 int n,m,i,j,next[N],l; 9 stack< 阅读全文
posted @ 2019-07-15 22:05
Snow_in_winer
阅读(142)
评论(0)
推荐(0)
摘要:
1 int gcd(int a,int b) { 2 if (!b) { 3 return a; 4 } 5 return gcd(b, a % b); 6 } 阅读全文
posted @ 2019-07-15 22:04
Snow_in_winer
阅读(116)
评论(0)
推荐(0)
摘要:
1 int linker[MAXN * 2]; 2 bool used[MAXN * 2]; 3 4 bool dfs(int u) { 5 for (int i = h[u]; i; i = e[i].n) { 6 int v = e[i].t; 7 if (!used[v]) { 8 used[v] = 1; ... 阅读全文
posted @ 2019-07-15 22:04
Snow_in_winer
阅读(207)
评论(0)
推荐(0)
摘要:
1 for (int k=1;i<=n;i++){ 2 for (int i=1;i<=n;i++){ 3 for (int j=1;j<=n;j++){ 4 f[i][j]=min(f[i][j],f[i][k]+f[k][j]); 5 } 6 } 7 } 阅读全文
posted @ 2019-07-15 22:03
Snow_in_winer
阅读(123)
评论(0)
推荐(0)
摘要:
/* 裴蜀定理: a,b d=(a,b) >ax+by=d=(a,b)*/int exgcd(int a,int b,int &x,int &y) { if (!b) { x = 1;y = 0;return a; } int d = exgcd(b, a % b, y, x); y -= a / 阅读全文
posted @ 2019-07-15 22:02
Snow_in_winer
阅读(126)
评论(0)
推荐(0)
摘要:
1 /* 2 算术基本定理 3 n=p1^a1*p2^a2*p3^a3*...*pn^an 4 5 约数个数:(p1+1)*(p2+1)*(p3+1)*..*(pn+1) 6 phi(n)=n*(1-1/p1)*(1-1/p2)*...*(1-1/pn) 7 8 欧拉数:1-n中与n互质的数的个数 9 phi(n)=n*(1-1/p1)*(1-1/p2)*...... 阅读全文
posted @ 2019-07-15 22:01
Snow_in_winer
阅读(141)
评论(0)
推荐(0)
摘要:
const int maxn=1e5+7; const int maxm=1e5+7; const int inf=0x3f3f3f3f; struct Dinic { struct Edge { int next, f, to; } e[maxm]; int head[maxn], dep[maxn], tol, ans; int cur[max... 阅读全文
posted @ 2019-07-15 22:00
Snow_in_winer
阅读(141)
评论(0)
推荐(0)
摘要:
void Dijkstra(int u) { memset(vis,0,sizeof(vis)); for(int t=1;t,vector >,greater > >q1; int dijkstra(int s,int t) { memset(d,inf,sizeof(d)); memset(v,0,sizeof(v)); d[s] = 0; q1.push(make_... 阅读全文
posted @ 2019-07-15 21:58
Snow_in_winer
阅读(140)
评论(0)
推荐(0)