03 2017 档案
摘要:https://www.luogu.org/problem/show?pid=2709#sub莫队经典题#include#include#include#include#includeusing namespace std;int n,m,k,sum=0;int num[50009...
阅读全文
摘要:https://www.luogu.org/problem/show?pid=1962#include#include#include#include#include#define mod 1000000007#define LL long longusing namespace ...
阅读全文
摘要:https://www.luogu.org/problem/show?pid=1972#sub 时间复杂度证明:右端点移动: 首先我们考虑一个块里面的转移情况 由于一个块里面的询问都按右端点排序 所以我们右端点在一个块里面最多移动n次 有 O(n√)O(n)个块,那么同一个块内的右...
阅读全文
摘要:http://www.ruanyifeng.com/blog/2015/09/matrix-multiplication.html
阅读全文
摘要:https://www.luogu.org/problem/show?pid=1101#sub#include#include#include#include#include#include#includeusing namespace std;int dx[]={0,1,1,1,...
阅读全文
摘要:https://www.vijos.org/p/1094差分约束: 用#include#include #include#include#include#includeusing namespace std;int n,m,times[1009];int num[10009*2],...
阅读全文
摘要:https://www.luogu.org/problem/show?pid=1605#subdfs#include#include#include#include#include#include#includeusing namespace std;int ans=0,n,m,t...
阅读全文
摘要:https://www.luogu.org/problem/show?pid=3388#sub#include#include#include#include#include#include#includeusing namespace std;int dfn[100009],lo...
阅读全文
摘要:#include#include#include#include#include#include#includeusing namespace std;int dfn[1001],low[1001],dfs_num=0,n,m,cnt=0,root;int num[2001],n...
阅读全文
摘要:https://www.luogu.org/problem/show?pid=1339Dijkstra最短路#include#include#include#include#include#include#includeusing namespace std;int w[2501]...
阅读全文
摘要:https://www.luogu.org/problem/show?pid=1801#sub用对顶堆来做: 上次输出第s小的数,在大根堆里储存s数(这个状态需要维护),在小根堆里存剩下的数,下一次输出时输出小根堆的顶,即是需要输出的值,s++#include#include#in...
阅读全文
摘要:#include#include#include#include#include#include#include using namespace std;int n,m,ans=0;struct H{ int p,a;}milk[5009];int my_comp(const...
阅读全文
摘要:https://www.luogu.org/record/lists?pid=P1204维护区间#include#include#include#include#include#include#include using namespace std;int n,max1=0,max...
阅读全文
摘要:https://www.luogu.org/problem/show?pid=1206#sub#include#include#include#include#include#include#include using namespace std;int B,a[1000],b[1...
阅读全文
摘要:https://www.luogu.org/problem/show?pid=1209贪心: 先把连着的牛们用板连起来(相连的几头牛称为),如果块数>m,则需要连板,显然把牛群中间相隔最短的连起来,长度就需要加上补上的这块。#include//减板 #include#include...
阅读全文
摘要:https://www.luogu.org/problem/lists?name=1203&orderitem=pid&tag=此题最恶心的是头与尾的处理!我竟然。#include#include#include#include#include#include#include us...
阅读全文
摘要:luogu——————解法: 一个绝对连通区域就是一个强连通分量 因为题目要求输出最大强连通分量的规模,所以不需要考虑重边的问题(即会出现大包小的情况),如果要输出教学区的个数,则需要减去此种情况#include#include#include#include#include#in...
阅读全文
摘要:luogu ——————思路和爱在心中差不多 爱在心中#include#include#include#include #include#include#includeusing namespace std;int num[50009],head[10009]...
阅读全文
摘要:luogu 解法:Kruskal最小生成树; 在构建最小生成树时,如果 s 与 t 在一个集合里时,当前边就是答案(因为便是按照升序排的)#include#include#include#include#include#include#includeusin...
阅读全文
摘要:luogu#include#include#include#include#include#include#include#define NN 500000using namespace std;int n,m,s;//vector a[NN+2];int num[2*NN+9]...
阅读全文
摘要:洛谷 1265#include#include#include#include#include#include#include#define pow1(x) (x)*(x)using namespace std;int n;double zx[5009],zy[5009],dis[...
阅读全文
摘要:luogu 1576错误: 第31行 maxd 类型为double,赋成int!解法: 把消耗转化为剩余 , 运用最短路算法dijstra来找一遍最长路#include#include#include#include#include#include#include#includeu...
阅读全文
摘要:洛谷此题。 调了2+小时。。 终其原因: 1、pow1(x) (x)*(x) ! 2、memset(127) 可能比 1e10 小 exin 至极 , 铭记!#include#include#include#include#include#include#include#in...
阅读全文
摘要:洛谷课本Page 466定理1:存在欧拉路的条件,图是连通的,有且只有 2 个奇点; 定理2:存在欧拉回路的条件,图是连通的,有 0 个奇点;#include#include#include#include#include#include#include#include using...
阅读全文
摘要:luogu坑: 图可能分为多个连通块,对于每个连通块都要找染色个数较小的那种颜色,sum进ans#include//对于每一块连通分量都应该能够分为二分图 才能够封锁全部的道路,否则Impossible #include#include#include#include#includ...
阅读全文
摘要:vijos#include#include#include#include#include#include#includeusing namespace std;vector a[202];int n,m,dfs_num=0,dfn[202],low[202],color_num...
阅读全文
摘要:vijos描述“每个人都拥有一个梦,即使彼此不相同,能够与你分享,无论失败成功都会感动。爱因为在心中,平凡而不平庸,世界就像迷宫,却又让我们此刻相逢Our Home。” 在爱的国度里有N个人,在他们的心中都有着一个爱的名单,上面记载着他所爱的人(不会出现自爱的情况)。爱是具有传递性...
阅读全文

浙公网安备 33010602011771号