摘要: 说了一大堆,其实就是求一个最长上升子序列,二分优化到nlogn就不会超时啦 #include #include #include #include using namespace std;const int maxn = 500000 + 5;const int INF = INT_MAX / 2;int top[maxn],r[maxn];int main() { int n... 阅读全文
posted @ 2014-03-22 22:03 acm_roll 阅读(118) 评论(0) 推荐(0) 编辑
摘要: 类似滑雪问题,在一个矩阵中求最大的上升路径累加和,并且在一个点一次可以走长度最大的为k的直线。并且起始位置一定是矩阵的左上角1,1。 把每个节点按照高度从低到高排序,然后枚举所有可能到达当前点的值,选其中最大的一个和当前点相加即可 #include #include #include using namespace std;struct Point { int x,y,h; ... 阅读全文
posted @ 2014-03-22 22:01 acm_roll 阅读(149) 评论(0) 推荐(0) 编辑