上一页 1 ··· 7 8 9 10 11 12 13 14 15 ··· 21 下一页
摘要: 题目 https://www.lydsy.com/JudgeOnline/problem.php?id=4818 思路 先考虑没有质数限制 dp是在同余系下的,所以$f[i][j]$表示前i个点,和为j的方案数 转移就是$f[i][j]=f[i 1][k]+g[(j k)\%p]$ g[i]是x%p 阅读全文
posted @ 2019-02-16 09:27 ComplexPug 阅读(117) 评论(0) 推荐(0) 编辑
摘要: 题目 https://loj.ac/problem/2005 思路 $$ \sum_{L}^{R}{(x_i x)^{2}} $$ $$ \sum_{L}^{R}{(x_i^2 2 x_i x+x^{2})} $$ $$ \sum_{L}^{R}{x_i^2} 2 x \sum_{L}^{R}x_i 阅读全文
posted @ 2019-02-15 19:57 ComplexPug 阅读(170) 评论(0) 推荐(0) 编辑
摘要: [TOC] 太才了 $\prod \limits_{i=1}^{n}\prod\limits_{j=1}^{m}f[gcd(i,j)]$ $\prod\limits_{k=1}^{n}f[k]^{\sum\limits_{i=1}^{n}\sum\limits_{j=1}^{m}[gcd(i,j)= 阅读全文
posted @ 2019-02-15 12:35 ComplexPug 阅读(322) 评论(0) 推荐(0) 编辑
摘要: 昨天写了一晚,越写复杂度越感觉不对,早上一想果然是假的。 (这里n,m,k我就不区分了) 首先一个城市的询问可以很容易的二分 check用树状数组维护区间(区间修改,单点查询的那种) 一次是$O(nlog^2n)$ n次就是$O(n^2log^2n)$ 但是我们check的时候都是树状数组维护,询问 阅读全文
posted @ 2019-02-15 10:09 ComplexPug 阅读(135) 评论(0) 推荐(0) 编辑
摘要: 链接 https://www.lydsy.com/JudgeOnline/problem.php?id=2440 题解 二分,转化为判定1到x内的无平方因子的数的个数 (范围自己二分着试) 然后容斥 含0个平方因子 含1个平方因子+含有两个平方因子~~~~ 于是观察一下上面那个式子,再联想mobiu 阅读全文
posted @ 2019-02-14 17:02 ComplexPug 阅读(133) 评论(0) 推荐(0) 编辑
摘要: [TOC] 机房最后一个学懵逼钨丝的人 题目一 链接 题目没找到 求$\sum_{1}^{n}\sum_{1}^{m}gcd(i,j)$ 式子 $\sum\limits_{i=1}^{N}\sum\limits_{j=1}^{M} gcd(i,j)$ $\sum\limits_{k=1}^{min( 阅读全文
posted @ 2019-02-14 11:14 ComplexPug 阅读(394) 评论(0) 推荐(1) 编辑
摘要: 链接 https://www.lydsy.com/JudgeOnline/problem.php?id=2870 思路 先把树转化为二叉树 再链分治 %%yyb 代码 cpp include include include include include include define ll long 阅读全文
posted @ 2019-02-13 10:05 ComplexPug 阅读(348) 评论(0) 推荐(0) 编辑
摘要: 链接 https://www.lydsy.com/JudgeOnline/problem.php?id=2152 luogu爆搜都能过,总时间超过100ms就是写错了 思路 直接mod上面跑点分治就行了,又是模板 代码 cpp include include include include usin 阅读全文
posted @ 2019-02-12 14:40 ComplexPug 阅读(91) 评论(0) 推荐(0) 编辑
摘要: 链接 https://www.lydsy.com/JudgeOnline/problem.php?id=3545 离线询问,按照权值排个序 就是在克鲁斯卡尔时候维护个treap,到时候挨个查询一下就好了 nb的gzy说要要在线才是呢,nb 代码 cpp / Problem: 3545 User: g 阅读全文
posted @ 2019-02-12 14:35 ComplexPug 阅读(217) 评论(5) 推荐(0) 编辑
摘要: 链接&&题面 https://www.lydsy.com/JudgeOnline/problem.php?id=2599 思路 没啥思路,就是模板题 只不过顺便维护桶的时候维护一个最小边数 不过最气人的是 我用手写栈会RE,会WR,会运行错误 我用stl的queue会wrong,会TLE 我用stl 阅读全文
posted @ 2019-02-12 09:14 ComplexPug 阅读(103) 评论(0) 推荐(0) 编辑
摘要: 1 点分治好难写呀 写的变量好多,太乱了,一点也不优美 代码 cpp include using namespace std; const int N=1e5+7; int read() { int x=0,f=1;char s=getchar(); for(;s '9'||s='0'&&s=sta 阅读全文
posted @ 2019-02-11 06:29 ComplexPug 阅读(104) 评论(0) 推荐(0) 编辑
摘要: 链接 https://www.luogu.org/problemnew/show/P1552 思路 忍者数量肯定越多越好 那就从下到上的合并它的孩子 左偏树的话 顺便维护一个tot,大头堆,如果tot大于了m,把大的删掉 如果左偏树忘干净了或者没学的话 线段树合并也是个不错的选择 直接权值线段树合并 阅读全文
posted @ 2019-02-10 16:59 ComplexPug 阅读(147) 评论(0) 推荐(0) 编辑
摘要: 链接 https://www.lydsy.com/JudgeOnline/problem.php?id=3262 思路 CDQ版本稍后再说 二维偏序排序用树状数组求就可以 而三维之后就不可以了,但我们可以在BIT上维护一个功能强大的treap 维护多出来的一维c BIT套treap a排序 BIT维 阅读全文
posted @ 2019-02-10 16:50 ComplexPug 阅读(166) 评论(0) 推荐(0) 编辑
摘要: 链接 https://www.lydsy.com/JudgeOnline/problem.php?id=1251 思路 好简单的模板题 不过还是wrong了好几发 叶子节点要注意下,不能使用 遇到就不管 写的fhq treap,OI中常数最大的平衡树,中间还T了一发 代码 cpp include i 阅读全文
posted @ 2019-02-10 15:29 ComplexPug 阅读(189) 评论(0) 推荐(0) 编辑
摘要: [TOC] 链接 https://www.luogu.org/problemnew/show/P4069 思路 树剖+超哥线段树 我已经自毙了,自闭了!!!! update 上次抄了没认真看,这次考试又自毙了 是一个细节的处理上一次没处理 代码 cpp include define ll long 阅读全文
posted @ 2019-02-09 21:57 ComplexPug 阅读(198) 评论(0) 推荐(0) 编辑
上一页 1 ··· 7 8 9 10 11 12 13 14 15 ··· 21 下一页