摘要: 题目描述 给出一张nn(n#include#include#include#include#include#include#include#includeusing namespace std;const int MAX=500010;const int INF=0x... 阅读全文
posted @ 2018-03-07 01:50 Menteur_hxy 阅读(242) 评论(0) 推荐(0) 编辑
摘要: Mondriaan’s Dream Time Limit: 3000MS Memory Limit: 65536K Total Submissions: 18903 Accepted: 10779 DescriptionSquares and ... 阅读全文
posted @ 2018-03-06 23:55 Menteur_hxy 阅读(109) 评论(0) 推荐(0) 编辑
摘要: code://By Menteur_Hxy#include#include#include#include#include#include#include#include#includeusing namespace std;const int MAX=500010;... 阅读全文
posted @ 2018-03-06 23:14 Menteur_hxy 阅读(105) 评论(0) 推荐(0) 编辑
摘要: 求lca的方法大体有三种: 1.dfs+RMQ(线段树 ST表什么的) 在线 2.倍增 在线 3.tarjan 离线ps:离线:所有查询全输入后一次解决 在线:有一个查询输出一次 以下模板题为 洛谷 P3379 【模板】最近公共祖先(LCA)1.首先dfs求出... 阅读全文
posted @ 2018-02-25 09:05 Menteur_hxy 阅读(208) 评论(0) 推荐(0) 编辑
摘要: 将文件放在一个文件夹,执行test即可 creatrand:#include#include#includeusing namespace std;int n,m,k;int main(){ freopen("in.txt","w",stdout); sr... 阅读全文
posted @ 2018-02-24 10:36 Menteur_hxy 阅读(152) 评论(0) 推荐(0) 编辑
摘要: 紫书:#include #include #include #include using namespace std; const int maxn = 1000; struct bign{ int d[maxn], len; ... 阅读全文
posted @ 2018-02-21 18:45 Menteur_hxy 阅读(125) 评论(0) 推荐(0) 编辑
摘要: 1.最长上升子序列(LIS)子序列: 1.可以不连续 2.相对位置不变 dp[i][j] 表示前i位置,最大值为j的LIS长度 1. dp[i-1][j] 前i-1位置,最大值为j的LIS长度 (没有考虑a[i]) 2. dp[i][j]=dp[i-1][k]+1 ... 阅读全文
posted @ 2018-02-21 18:27 Menteur_hxy 阅读(266) 评论(0) 推荐(0) 编辑
摘要: 题目描述 如题,给出两个字符串s1和s2,其中s2为s1的子串,求出s2在s1中所有出现的位置。 为了减少骗分的情况,接下来还要输出子串的前缀数组next。 (如果你不知道这是什么意思也不要问,去百度搜[kmp算法]学习一下就知道了。) 输入输出格式 输入格式: 第一行为一个字符串,即为s1 第二行 阅读全文
posted @ 2018-02-12 23:26 Menteur_hxy 阅读(153) 评论(0) 推荐(0) 编辑
摘要: 给定一个数列 ai O(nlogn) 预处理 O(1) 查询区间最值 定义f(i,j) 为ai开始,包括ai的连续2^j个元素的最值 下面以最大值为例: f(i,j)表示max{ak}(k∈[i,i+2^j)). 利用倍增: f[i][j]= {aimax(f[i][j−1],f[i+2j−1][j 阅读全文
posted @ 2018-02-12 20:44 Menteur_hxy 阅读(121) 评论(0) 推荐(0) 编辑
摘要: http://blog.csdn.net/clove_unique/article/details/50630280 阅读全文
posted @ 2018-02-12 00:00 Menteur_hxy 阅读(121) 评论(0) 推荐(0) 编辑