Evanyou Blog 彩带
摘要: "传送门" include include include include include include define re register using namespace std; inline int read(){ char ch = getchar(); int f = 1 , x = 阅读全文
posted @ 2018-11-08 21:36 Stephen_F 阅读(160) 评论(0) 推荐(0) 编辑
摘要: "传送门" 代码中体现在那个 $ break $ $ prime $ 数组 中的素数是递增的,当 $ i $ 能整除 $ prime[j ] $ ,那么 $ i prime[j+1] $ 这个合数肯定被 $ prime[j] $ 乘以某个数筛掉。 因为i中含有 $ prime[j] $ , $ pr 阅读全文
posted @ 2018-11-08 21:28 Stephen_F 阅读(165) 评论(0) 推荐(0) 编辑
摘要: "传送门" include include include include using namespace std; int n; long long a[100005]; inline void quick_sort(int l,int r) { int i = l , j = r ; int m 阅读全文
posted @ 2018-11-08 21:10 Stephen_F 阅读(239) 评论(0) 推荐(0) 编辑
摘要: "传送门" 线性递推 include include include include include define re register using namespace std; const int maxn = 3000005; int n; long long mod; int p[maxn] 阅读全文
posted @ 2018-11-08 21:07 Stephen_F 阅读(128) 评论(0) 推荐(0) 编辑
摘要: "传送门" include include include include include include define re register using namespace std; const int maxn = 10005; const int maxm = 200005; inline 阅读全文
posted @ 2018-11-08 20:36 Stephen_F 阅读(159) 评论(0) 推荐(0) 编辑
摘要: "传送门" include include include include include define re register using namespace std; const int maxn = 2005; const int maxm = 3005; inline int read(){ 阅读全文
posted @ 2018-11-08 20:10 Stephen_F 阅读(100) 评论(0) 推荐(0) 编辑
摘要: "传送门" 有向图。。 代码中有两种方法,拓扑排序和记忆化搜索 include include include include include define re register using namespace std ; const int maxn = 1e5 + 4 ; inline int 阅读全文
posted @ 2018-11-08 19:35 Stephen_F 阅读(110) 评论(0) 推荐(0) 编辑
摘要: "传送门" 思路分析 怎么求解呢? 其实我们可以把左边的式子当成一个算式来计算,从1到 $ m $ 枚举,只要结果是0,那么当前枚举到的值就是这个等式的解了。可以通过编写一个 $ bool $ 函数来判断算式的值是不是0 至于如何计算这个多项式,用秦九韶算法就可以解决 细节提示 : 1.防爆 $ i 阅读全文
posted @ 2018-11-08 18:16 Stephen_F 阅读(107) 评论(0) 推荐(0) 编辑
摘要: "传送门啦" include include include include define re register using namespace std; const int maxn = 5005; const int maxm = 200005; inline int read(){ char 阅读全文
posted @ 2018-11-08 17:26 Stephen_F 阅读(124) 评论(0) 推荐(0) 编辑
摘要: "传送门啦" 阅读全文
posted @ 2018-11-08 17:25 Stephen_F 阅读(128) 评论(0) 推荐(0) 编辑
摘要: "传送门啦" 这道题的特殊之处在于对于任意一个并查集,只要告诉你某个节点的物种,你就可以知道所有节点对应的物种。 比如一条长为4的链 甲 乙 丙 丁 ,我们知道乙是A物种。那么甲一定是B物种,因为A只吃B物种,不吃C物种或是自己的同类。同样的丙一定是C物种,丁是B物种。 也就是说,每一条链上都是A、 阅读全文
posted @ 2018-11-08 17:03 Stephen_F 阅读(126) 评论(0) 推荐(0) 编辑
摘要: "传送门啦" 要求的就是,把树上的一条边的权值设为0之后,所有路径中的最大值的最小值。 首先二分最大值,假设某次二分的最大值为x,我们首先找出所有大于x的路径(也就是我们需要通过改权缩短的路径),并把路径上的所有边都标记一下。 在标记完成后,枚举所有边,如果存在一条边位于所有长度大于于x的路径上,并 阅读全文
posted @ 2018-11-08 16:03 Stephen_F 阅读(161) 评论(0) 推荐(0) 编辑
摘要: "传送门啦" 倍增 $ Floyd $ 注意结构体里二维数组不能开到 $ 2000 $ include include include include define Re register using namespace std; inline int read(){ char ch = getch 阅读全文
posted @ 2018-11-08 16:00 Stephen_F 阅读(162) 评论(0) 推荐(0) 编辑