摘要:
这道题加强了我对dp和等差数列的认识。。。 暴力做法是我第一个想出来的,但是可能实现起来还比满分做法复杂。。。 暴力能拿30pts。 暴力太难做的就要想想dp!也许用dp,问题就变得很容易求的了。 这里有两种思路。 法一 用 表示等差数列最后第二项的值为$h[i]$,最后一项$h[j]$的方案数。 阅读全文
摘要:
暴力出奇迹! 讲道理,刚看到什么数组乘以下标,我就已经吓傻了。 ~~woc,区间加还不能用差分,这怎么可能做得了啊~~ 其实 暴力 就完事了。 先看看数据范围:$n \leq 80000, opt \leq 1000000, Q \leq 1000, Final \leq 10000000$ 这能够 阅读全文
摘要:
状压dp水题 俗话说:能打暴力的都是简单题,因为你可以用暴力来对拍啊!那么只要你足够强,你就能写出一个正解而不出现WA。 暴力做法就是直接枚举全排列,一个一个算即可。 正解是定义 为最后一个元素为$i$,选中的状态为$j$的方案数。转移很显然,太显然了。不说了。 所以最后把$\sum{dp[i][S 阅读全文
摘要:
two pointers problem There is a similar problem called "guanghuazhan". You can find it in my blog. Obviously we can use two pointers. But the index is 阅读全文
摘要:
heavy light decomposition & segment tree problem which need lots of detail Last night I reinstalled my manjaro linux and it hasn't installed any app w 阅读全文