摘要: KMP算法模板 原理 见参考文章 模板 c++ include include define max_n 100005 using namespace std; char s[max_n] = {'a','a','b','a','a','a','b','c'}; char p[max_n] = {' 阅读全文
posted @ 2019-08-08 10:16 小张人 阅读(117) 评论(0) 推荐(0) 编辑
摘要: 题目描述: Ciel the Commander time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Now Fox Ciel bec 阅读全文
posted @ 2019-08-07 14:21 小张人 阅读(117) 评论(0) 推荐(0) 编辑
摘要: 点分治模板 点分治: 这里统一地,只讲一下主要思想,各种细节留给 参考文章 。 点分治的主要是处理树上的路径问题,如果用暴力做法求解会有很高的时间复杂度$O(n^2) O(n^3)$的样子。而如果使用点分治,就可以将复杂度降为$O(nlog_2n)$。主要思路是将一棵树分解成若干子树,在分解成子树的 阅读全文
posted @ 2019-08-07 10:38 小张人 阅读(468) 评论(2) 推荐(1) 编辑
摘要: 题目描述: Vessels time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output There is a system of n ves 阅读全文
posted @ 2019-08-06 17:37 小张人 阅读(277) 评论(0) 推荐(0) 编辑
摘要: 题目描述: Maximum Value time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output You are given a seque 阅读全文
posted @ 2019-08-06 13:29 小张人 阅读(196) 评论(0) 推荐(0) 编辑
摘要: 题目描述: Little Elephant and Interval time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output The L 阅读全文
posted @ 2019-08-06 11:10 小张人 阅读(332) 评论(0) 推荐(0) 编辑
摘要: 题目描述: Farmer John has installed a new system of N−1N 1N−1 pipes to transport milk between the NNN stalls in his barn (2≤N≤50,0002 \leq N \leq 50,0002≤ 阅读全文
posted @ 2019-08-04 21:45 小张人 阅读(344) 评论(0) 推荐(0) 编辑
摘要: 题目描述: Alyona and a tree time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output Alyona has a tre 阅读全文
posted @ 2019-08-04 20:07 小张人 阅读(230) 评论(0) 推荐(0) 编辑
摘要: 倍增法求lca(最近公共祖先) 基本上每篇博客都会有参考文章,一是弥补不足,二是这本身也是我学习过程中找到的觉得好的资料 思路: 大致上算法的思路是这样发展来的。 想到求两个结点的最小公共祖先,我们可以先把两个的深度提到同一水平,在一步一步往上跳,直到两个结点有了一个公共祖先,依照算法流程,这就是l 阅读全文
posted @ 2019-08-04 19:32 小张人 阅读(580) 评论(1) 推荐(2) 编辑
摘要: 题目描述: Jzzhu and Cities time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output Jzzhu is the pres 阅读全文
posted @ 2019-08-04 11:08 小张人 阅读(323) 评论(0) 推荐(0) 编辑
分享到: