随笔分类 - 题
摘要:模板拓扑(或许) #include<bits/stdc++.h> using namespace std; struct edge { int to,val,nxt; } e[10005]; struct answer { int id,val; } ans[105]; int h,m,n,t,u,
阅读全文
摘要:最大生成树+lca。 参考资料 思路 首先便是想到了Floyd的暴力方法,状态转移方程也不难推出:w[i][j]=max(w[i][j], min(w[i][k],w[k][j]));但是n3次方时间复杂度和n2的空间复杂度是显然不可取的。 于是我们思考,可以发现有一些权值较小的边是不会被走过的。正
阅读全文
摘要:早过了,但O2会爆 于是进行面向题解的编码 裸kruskal #include<bits/stdc++.h> using namespace std; struct node { int x,y,s; } d[200000]; int n,m,ans,num,f[1000],w,k,c; bool
阅读全文
摘要:题目题解 but my code is outing #include<bits/stdc++.h> using namespace std; const int B=2e9; struct dot{ int x,y; }a[200010],ddt[200010]; inline int ass(i
阅读全文
摘要:105,一眼nlogn。 考虑能不能写线段树(毕竟我只会这一种树状结构)。 发现很难想…… 看来得靠分治了 复习一手CDQ ??? 看了一眼题解 原来,我只是没想到前缀和,嘤嘤嘤 然后就成归并排序求逆序对了,只不过要加上0 然而90pts??? 不开ll见祖宗啊…… 简单放个代码 #include<
阅读全文
摘要:#include<bits/stdc++.h> using namespace std; namespace IO { char buf[50]; } inline void qr(int &x){char ch=getchar(),lst=' ';while(ch>'9'||ch<'0')lst=
阅读全文
摘要:又角果,唐 #include<bits/stdc++.h> using namespace std; const int inf=0x3f3f3f3f; int n,ans=-inf; int a[105]; int f[150][150],g[150][150]; char c[105]; int
阅读全文
摘要:题解 #include<bits/stdc++.h> using namespace std; struct edge { int to,nxt; } e[1000010<<1]; int n,cnt,id; int head[1000010]; long long ans; long long f
阅读全文
摘要:buxiangzuola #include<bits/stdc++.h> using namespace std; #define F(i,a,b) for(register int i=a,i##end=b;i<=i##end;++i) #define UF(i,a,b) for(register
阅读全文
摘要:切不动了!!! #include<bits/stdc++.h> #define rep(i,a,b) for(int i=a;i<=b;++i) using namespace std; inline int read(){int x=0;bool f=0;char ch=getchar();whi
阅读全文
摘要:#include<bits/stdc++.h> using namespace std; int p,q,dp[15][15],a[15]; void init() { for(int i=0;i<=9;i++) dp[1][i]=1; for(int i=2;i<=10;i++)for(int j
阅读全文
摘要:#include <bits/stdc++.h> using namespace std; typedef long long long long; const int INF=0x3f3f3f3f; const long long mod=1e9+7; long long c1[1000005],
阅读全文
摘要:sb大括号,卡我114514ms #include <bits/stdc++.h> using namespace std; const int maxn=100005,maxk=104,mod=1000000007; int f[maxn][maxk][2][2]; int g[maxk][2][
阅读全文
摘要:胶过,唐 #include<bits/stdc++.h> using namespace std; int n,m; double a[100010]; struct node { double mx; int len; #define m(x) t[x].mx #define l(x) t[x].
阅读全文
摘要:#include<bits/stdc++.h> using namespace std; inline int read(){int x=0;bool f=0;char ch=getchar();while (ch<'0'||ch>'9'){if (ch=='-') f=1;ch=getchar()
阅读全文
摘要:kmkmp #include<bits/stdc++.h> using namespace std; char str[1500005]; int n,kmp[1500005],cir[1500005],tms[30],suf[1500005],pre[2500005],per[27],cnt; l
阅读全文
摘要:首先,这题最好的一个地方,在于它给出的关于next的讲解实在是妙极!!!!! 这题比我讲的好100倍! 赞美lg 捧lg的话到此为止,进入正文 题解 #include<bits/stdc++.h> using namespace std; const long long MOD=1e9+7; int
阅读全文
摘要:最后还是照着题解A了这道题…… #include <bits/stdc++.h> using namespace std; int n,m,s,t,edge_sum=1; int maxflow,mincost; int dis[5005],head[5005],incf[5005],pre[500
阅读全文
摘要:oh dear #include<bits/stdc++.h> using namespace std; int n,k,m,s,t,a[105][105],wen[105]; int d[100005]; bool vis[100005]; int qi,mo,f; inline int read
阅读全文
摘要:酷狗没会员了QAQ #include<bits/stdc++.h> using namespace std; int n,m,f[1001],enm[1001]; int find(int x) { if(f[x]!=x) x=find(f[x]); return x; } void hebing(
阅读全文