摘要:
二维BIT。。。 感觉不会树状数组还是不太好。。而且这题用线段树肯定MLE。。 1 #include<bits/stdc++.h> 2 #define inc(i,l,r) for(int i=l;i<=r;i++) 3 #define dec(i,l,r) for(int i=l;i>=r;i--
阅读全文
posted @ 2016-02-12 12:34
onlyRP
阅读(225)
推荐(0)
摘要:
没有题面差评 先来遍SA求出h,再给h排序,从大到小计算,并查集维护连续的区间(表达能力太弱。。还是看代码好说话) 1 #include<bits/stdc++.h> 2 #define inc(i,l,r) for(int i=l;i<=r;i++) 3 #define dec(i,l,r) fo
阅读全文
posted @ 2016-02-11 23:01
onlyRP
阅读(145)
推荐(0)
摘要:
明显要用求SA再求h,而lcp(i,j)就等于i到j之间最小的h 用f[i]表示i跟比i大的后缀的lcp的和,然后用单调栈维护最小值就好了(有点像DP?) 1 #include<bits/stdc++.h> 2 #define inc(i,l,r) for(int i=l;i<=r;i++) 3 #
阅读全文
posted @ 2016-02-11 16:11
onlyRP
阅读(173)
推荐(0)
摘要:
复制一下原串处理环,然后直接出SA就可以了 1 #include<bits/stdc++.h> 2 #define inc(i,l,r) for(int i=l;i<=r;i++) 3 #define dec(i,l,r) for(int i=l;i>=r;i--) 4 #define link(x
阅读全文
posted @ 2016-02-10 19:52
onlyRP
阅读(177)
推荐(0)
摘要:
SA入门题,将2个串中间用另外的字符链接即可 调了半天一直以为是模板的错,原来是乘法超了intQAQ 不好意思。。传错代码,误认子弟(啪啪啪 1 #include<bits/stdc++.h> 2 #define inc(i,l,r) for(int i=l;i<=r;i++) 3 #define
阅读全文
posted @ 2016-02-10 18:17
onlyRP
阅读(275)
推荐(0)
摘要:
状压DP,f[i][j]表示在i状态下余数为j的情况 然后就是i的表示。。先认为数字互不相同(坑爹的想法= =),然后就有没有用到压缩状态 然后还要去重。。对每个数字来说除以数字个数的阶乘即可 1 #include<bits/stdc++.h> 2 #define inc(i,l,r) for(in
阅读全文
posted @ 2016-02-06 00:56
onlyRP
阅读(207)
推荐(0)
摘要:
最近好懒散QAQ 就是状压DP+概率。。由于顺着推还要计方案数略麻烦,所以就倒着推 1 #include<bits/stdc++.h> 2 #define inc(i,l,r) for(int i=l;i<=r;i++) 3 #define dec(i,l,r) for(int i=l;i>=r;i
阅读全文
posted @ 2016-02-05 20:45
onlyRP
阅读(127)
推荐(0)
摘要:
把边当做一个状态(orz居然有这种想法),初始点也看成边,然后矩阵快速幂就可以了(感觉有点像flyod) 1 #include<bits/stdc++.h> 2 #define inc(i,l,r) for(int i=l;i<=r;i++) 3 #define dec(i,l,r) for(int
阅读全文
posted @ 2016-02-04 21:18
onlyRP
阅读(165)
推荐(0)
摘要:
先预处理莫比乌斯函数,再分块求 不会用公式编辑TAT,直接贴题解吧。。 从结论来看貌似也能用容斥原理? 1 #include<bits/stdc++.h> 2 #define inc(i,l,r) for(int i=l;i<=r;i++) 3 #define dec(i,l,r) for(int
阅读全文
posted @ 2016-02-03 13:33
onlyRP
阅读(116)
推荐(0)
摘要:
今天题目看来看去都觉得不可以做啊,数论弱到不堪直视 分为2个部分,对于n>k部分直接n*(n-k) 对于n<=k部分,x%i=x-(x/i)*i,这样就可以枚举商,然后分段加起来。。 1 #include<bits/stdc++.h> 2 #define inc(i,l,r) for(int i=l
阅读全文
posted @ 2016-02-03 00:22
onlyRP
阅读(125)
推荐(0)