摘要:
树分治 求逆元请递推,不然会TLE 开桶记录即可 注意常数 # pragma comment(linker,"/STACK:102400000,102400000") # include <stdio.h> # include <stdlib.h> # include <iostream> # in 阅读全文
posted @ 2017-12-12 19:40
Cyhlnj
阅读(283)
评论(0)
推荐(0)
摘要:
树分治,每次把每个点的deep取出,排序。。。尺取法。。。 # include <stdio.h> # include <stdlib.h> # include <iostream> # include <algorithm> # include <string.h> # define IL inl 阅读全文
posted @ 2017-12-12 19:37
Cyhlnj
阅读(148)
评论(0)
推荐(0)
摘要:
树分治,每次统计时有两种组合%3==2和%3==1, %3==0和%3==0 乘法原理即可 # include <stdio.h> # include <stdlib.h> # include <iostream> # include <algorithm> # include <string.h> 阅读全文
posted @ 2017-12-12 19:36
Cyhlnj
阅读(147)
评论(0)
推荐(0)
摘要:
map+floyed+矩阵乘法(倍增floyed) # include <stdio.h> # include <stdlib.h> # include <iostream> # include <algorithm> # include <string.h> # include <map> # d 阅读全文
posted @ 2017-12-12 19:32
Cyhlnj
阅读(124)
评论(0)
推荐(0)
摘要:
KMP暴力求出next数组后 实际上是一个最短路问题,floyed搞一搞 然而会TLE 矩阵优化一下即可(倍增floyed) KMP在弱数据下可以AC。。正解请看其他人博客 # include <stdio.h> # include <stdlib.h> # include <iostream> # 阅读全文
posted @ 2017-12-12 19:31
Cyhlnj
阅读(340)
评论(0)
推荐(0)
摘要:
AC自动机建立fail树后树上DP # include <stdio.h> # include <stdlib.h> # include <iostream> # include <string.h> # include <algorithm> # include <queue> # define 阅读全文
posted @ 2017-12-12 19:27
Cyhlnj
阅读(199)
评论(0)
推荐(0)
摘要:
显然知道一个节点就可以推出整棵树 然而直接乘会爆longlong 所以考虑取log 最后排序算众数即可 # include <stdio.h> # include <stdlib.h> # include <iostream> # include <algorithm> # include <str 阅读全文
posted @ 2017-12-12 19:19
Cyhlnj
阅读(172)
评论(0)
推荐(0)
摘要:
有点像SDOI仪仗队 注解见代码 # include <stdio.h> # include <stdlib.h> # include <iostream> # include <algorithm> # include <string.h> # define IL inline # define 阅读全文
posted @ 2017-12-12 19:15
Cyhlnj
阅读(98)
评论(0)
推荐(0)
摘要:
实际上就是求Gcd(i - 1, j - 1) == 1 的 (i, j) i >= 2, j >= 2 的个数加2 i - 1 和 j - 1 互质 那不就是sigma phi(i - 1) 最后答案*2+1即可 # include <stdio.h> # include <stdlib.h> # 阅读全文
posted @ 2017-12-12 19:12
Cyhlnj
阅读(133)
评论(0)
推荐(0)

浙公网安备 33010602011771号