随笔分类 - 搜索
摘要:题意:。。。咕咕懒得写了。 思路: 裸的记搜... c++ include using namespace std; define ll long long mapmp[200010]; ll L,R; inline int read() { int q=0,f=1;char ch = getcha
阅读全文
摘要:题意:求树上两条路径有无祖先。 思路: 瞎搞$LCA$啊。。。 可惜我$LCA$打错了,我居然调了半小时...qwq c++ include using namespace std; const int maxn = 200010; define travel(i,x) for(int i = he
阅读全文
摘要:题意:求最少LIS覆盖... 思路: 计算$LIS$时我们一般用$dp$表示到当先位置时以当前位置结尾的$LIS$最长长度。 那么这个数组保证单调不降,我们考虑二进制表示。 然后就是转移了... 不过蜜汁$RE$啊,自测能过... c++ include using namespace std; i
阅读全文
摘要:题目:从u到v经过多少条边。 思路: 考虑他是怎么走的?? 从$u$到$v$一定是$fa[u]$,$fa[fa[u]]$,反正就是走$LCA$,那么如果算出每个点到父亲的期望步数,和父亲到该点的期望步数就可做了。 设$f(x) : x fa,g(x) : fa x$. 那么: $f(x) = {1
阅读全文
摘要:$T1$ 直接考虑二分就可以了。。。 二分spfa判断,直接AC一发! $T2$ 推式子题。。。其实如果不想推的话可以直接高精。。。 c++ include using namespace std; define ll long long const int maxn = 4010; const i
阅读全文
摘要:Day1:二分答案,三分查找,快速幂,欧拉筛素数 | 题目:火星人,Bridge,GCD,Prime Path 二分答案 【JSOI 2008】 火星人 对于第一个操作用$hash + 二分$来求得,二三直接平衡树维护即可。 【Bridge】 混合图欧拉回路模板,还是挺有意思OTZ... 具体就是首
阅读全文

浙公网安备 33010602011771号