摘要: "Tree" 参考 xk 老哥的博客: "POJ 1741 Tree 点分治" 找重心: cpp int d[maxn],dcnt; void dfs(int fa,int u,int w) { d[++dcnt]=w; siz[u]=1; for(int i=head[u];~i;i=e[i].n 阅读全文
posted @ 2019-08-14 22:23 caoanda 阅读(223) 评论(0) 推荐(0) 编辑
摘要: "F1. Complete the Projects (easy version)" "F2. Complete the Projects (hard version)" 参考: "Complete the Projects" 简单说就是当 b =0 是肯定是 a 小的优先的,需要注意的就是 b 需 阅读全文
posted @ 2019-08-14 15:14 caoanda 阅读(299) 评论(0) 推荐(0) 编辑
摘要: vector 开动态数组: 求一个数二进制中 1 的个数: 求一个数二进制中前缀 0 的个数: 求一个数二进制中后缀 0 的个数: 求 x 与 y 的 gcd: (需要头文件 algorithm) 补充: "一些奇奇怪怪的快捷小函数" 阅读全文
posted @ 2019-08-14 13:31 caoanda 阅读(118) 评论(0) 推荐(0) 编辑
摘要: 持续更新... Wrong Answer 1. 数组开小了 2. 爆 int Time Limited Error 1. 数组开小了 2. 爆 int 3. 数组开得过大,有可能会导致 tle Runtime Error 1. 数组开小了 2. INTEGER_DIVIDE_BY_ZERO 除零错或 阅读全文
posted @ 2019-08-14 10:36 caoanda 阅读(172) 评论(0) 推荐(0) 编辑
摘要: "D2. Remove the Substring (hard version)" 思路:其实就是贪心吧,先从前往后找,找到 t 可在 s 中存在的最小位置 (pre),再从后往前找,找到 t 可在 s 中存在的最大位置(last),然后 last [ i+1 ] pre [ i ] 1 表示的即是 阅读全文
posted @ 2019-08-14 09:57 caoanda 阅读(157) 评论(0) 推荐(0) 编辑