上一页 1 ··· 14 15 16 17 18 19 20 21 22 ··· 26 下一页
摘要: 传送门:http://www.lydsy.com/JudgeOnline/problem.php?id=4653 【题解】 首先把区间按长度从小到大排好序。 那么取一些区间,花费为长度最大-长度最小,相当于把这个长度区间里面的区间都取了。 求是不是有一个位置被覆盖超过了m次。 那么这个用two-po 阅读全文
posted @ 2017-05-29 14:09 Galaxies 阅读(206) 评论(0) 推荐(0)
摘要: 传送门:http://www.lydsy.com/JudgeOnline/problem.php?id=3611 【题解】 和bzoj2286一样,建虚树出来,在虚数上dp。 第一问分别考虑每条边的贡献即可。 第二问和第三问dp。 f[x][0/1],g[x][0/1]表示x子树,两个端点都在子树内 阅读全文
posted @ 2017-05-29 11:00 Galaxies 阅读(287) 评论(0) 推荐(0)
摘要: 传送门:http://www.lydsy.com/JudgeOnline/problem.php?id=2286 【题解】这bzoj题目少了一个右括号…… 这题朴素dp是O(nq)的,f[x]表示x及其子树有补给站的断开的min,直接转移。 发现这样无用的点很多,考虑建虚树,虚树上的点只有最多2m个 阅读全文
posted @ 2017-05-29 09:56 Galaxies 阅读(231) 评论(0) 推荐(0)
摘要: 传送门:https://www.hackerrank.com/contests/world-codesprint-11/challenges/hackerland 【题解】 因为加点每次加1个点1条边,所以不会存在一定要经过后加的那些点才能到达的情况。 直接把最后的图建出来,tarjan缩强联通分量 阅读全文
posted @ 2017-05-29 07:48 Galaxies 阅读(356) 评论(0) 推荐(0)
摘要: 传送门:http://www.lydsy.com/JudgeOnline/problem.php?id=3613 【题解】 其实挺显然。。就是最大逆序对差/2 # include <stdio.h> # include <string.h> # include <iostream> # includ 阅读全文
posted @ 2017-05-28 22:42 Galaxies 阅读(207) 评论(0) 推荐(0)
摘要: 传送门:http://www.lydsy.com/JudgeOnline/problem.php?id=3622 【题解】 XJOI noip模拟题的一题吧 这题统计方法用容斥 f[i,j]表示前i个人,j个一定赢,其他不管的方案数。 先考虑一定赢的转移,最后乘不论输赢的排列即可。 那么ans[n] 阅读全文
posted @ 2017-05-28 21:26 Galaxies 阅读(445) 评论(0) 推荐(0)
摘要: 传送门:http://www.lydsy.com/JudgeOnline/problem.php?id=4128 【题解】 矩阵版本的BSGS。 至于如何不需要求逆,详见:http://www.cnblogs.com/galaxies/p/bzoj2480.html # include <map> 阅读全文
posted @ 2017-05-28 14:49 Galaxies 阅读(242) 评论(0) 推荐(0)
摘要: 传送门:http://www.lydsy.com/JudgeOnline/problem.php?id=2480 【题解】 大步小步算法(BSGS) 一直觉得BSGS不大优美因为算法里混杂着一个求逆元,这对推exgcd要好久的人不大兹磁啊。。 参考:http://blog.miskcoo.com/2 阅读全文
posted @ 2017-05-28 14:35 Galaxies 阅读(582) 评论(0) 推荐(0)
摘要: 传送门:http://www.lydsy.com/JudgeOnline/problem.php?id=4886 【题解】 跟bzoj4883:http://www.cnblogs.com/galaxies/p/bzoj4833.html很相似啊 我们对于a,b离散后建点,那么一个卡片就相当于a到b 阅读全文
posted @ 2017-05-28 09:04 Galaxies 阅读(457) 评论(0) 推荐(0)
摘要: 传送门:http://www.lydsy.com/JudgeOnline/problem.php?id=4802 【题解】 参考:http://www.matrix67.com/blog/archives/234 Millar-Rabin质数检验方法: 根据费马小定理,如果p是素数,a<p,那么有a 阅读全文
posted @ 2017-05-27 22:03 Galaxies 阅读(1863) 评论(1) 推荐(0)
上一页 1 ··· 14 15 16 17 18 19 20 21 22 ··· 26 下一页