摘要: 题意 有n棵树排成一排,每个树上都有c[i]只小鸟,只有站在树下才可以召唤小鸟,在i-th树下召唤k(k<=c[i])只小鸟需要消耗cost[i]*k的法力值,但是每召唤一只小鸟可以将法力值的上限增加B,每次到下一棵树时候,法力值会恢复X(但是不会超过上线),初始时的法力值和上限都是W。 分析 em 阅读全文
posted @ 2018-04-14 00:24 蒟蒻LQL 阅读(188) 评论(0) 推荐(1) 编辑
摘要: 题意 给出一个只含有1和2的序列,有n个元素,可以选择一段区间进行翻转操作,求再反转后的最大非递减子序列的长度 分析 太菜了只想出了N^2的做法。序列只有1和2,那么每个非递减子序列都会有一个分界点,在分界点前是1以后是2。观察可以发现,只有当翻转的区间包含这个分界点的时候,这个分界点的非递减子序列 阅读全文
posted @ 2018-04-14 00:20 蒟蒻LQL 阅读(324) 评论(0) 推荐(1) 编辑
摘要: 感觉这个题不错,对拓扑排序有了更深的了解,用两种拓扑排序都写了些试试。 dfs 1 #include <cstdio> 2 #include <algorithm> 3 #include <iostream> 4 #include <cstring> 5 #include <vector> 6 us 阅读全文
posted @ 2018-04-14 00:16 蒟蒻LQL 阅读(210) 评论(0) 推荐(1) 编辑
摘要: 题意 在一个DAG上面有N个点M条边,每一条边上都有一个小写字母。两个人Max and Lucas 每个人一颗棋子,两个人轮流行棋,当前这一步选择的路上面的字母必须大于等于上一步路上面的字母,当轮到一个人她无法行棋时她便输了。每个人行棋时走会走最优情况。输出所有两个人初始位置的输赢情况。 分析 记忆 阅读全文
posted @ 2018-04-14 00:14 蒟蒻LQL 阅读(189) 评论(0) 推荐(1) 编辑
摘要: 题意 一串括号字符串,里面存在一些‘?’,其中‘?’既可以当作 '(' 又可以当作 ')' ,计算有多少对(l,r),在s中[sl,s(l+1),s(l+2),.....sr],内的括号是匹配的。n=strlen(s)<=5000。 分析 这个题还是卡了很久的,我果然是很菜的。 (错误思路)一开始的 阅读全文
posted @ 2018-04-14 00:12 蒟蒻LQL 阅读(271) 评论(0) 推荐(1) 编辑
摘要: 题意 将一段序列分割为任意段,每一段的连续和不超过M,使得每一段最大值的和最小. 分析 用单调队列进行优化的dp。单调队列可以维护可以影响当前区间的最大值。 1 #include <cstdio> 2 #include <cstring> 3 #include <algorithm> 4 #incl 阅读全文
posted @ 2018-04-14 00:07 蒟蒻LQL 阅读(416) 评论(0) 推荐(1) 编辑
摘要: 分析:这个题的关键是要找到,当某个值是最小值时它最大的影响区间时什么。可以通过单调队列(单调栈)在nlogn的时间内实现 1 #include <cstdio> 2 #include <cstring> 3 #include <algorithm> 4 #include <iostream> 5 # 阅读全文
posted @ 2018-04-14 00:05 蒟蒻LQL 阅读(300) 评论(1) 推荐(1) 编辑
摘要: 题意:There is a sequence of integers. Your task is to find the longest subsequence that satisfies the following condition: the difference between the ma 阅读全文
posted @ 2018-04-14 00:04 蒟蒻LQL 阅读(116) 评论(0) 推荐(1) 编辑
摘要: 题意given a circle sequence A[1],A[2],A[3]......A[n]. Circle sequence means the left neighbour of A[1] is A[n] , and the right neighbour of A[n] is A[1] 阅读全文
posted @ 2018-04-14 00:01 蒟蒻LQL 阅读(237) 评论(0) 推荐(2) 编辑
摘要: 单点修改 1 #include <cstdio> 2 #include <iostream> 3 #include <cstring> 4 #include <algorithm> 5 using namespace std; 6 const int INF=2147000000; 7 const 阅读全文
posted @ 2018-04-13 23:54 蒟蒻LQL 阅读(115) 评论(0) 推荐(1) 编辑