摘要: 经典的石子合并问题,代价w(i,j)满足四边形不等式的性质,所以可以通过决策的单调性求解 代码: #include<iostream> #include<cstdio> #include<cstring> using namespace std; const int N = 500; int f[N 阅读全文
posted @ 2020-08-05 12:03 WA自动机~ 阅读(214) 评论(0) 推荐(0) 编辑
摘要: 题目链接:https://www.acwing.com/problem/content/description/306/ 给出n行字符串,现在将其排版,定义一个不协调度,dp中只需要记录阶段为前i个句子已经排好版,不需要记录排了多少行。通过dp进行转移之后发现如果用朴素算法一定会超时。 经过对代价函 阅读全文
posted @ 2020-08-05 10:47 WA自动机~ 阅读(276) 评论(0) 推荐(0) 编辑