摘要: http://acm.sdut.edu.cn/sdutoj/problem.php?action=showproblem&problemid=2412先dp出每个时刻的所能获得的最大分值,线段树维护每个时刻的最优值,对于i时刻,可以先求出区间1到i-m-1的最大值,然后更新i。 1 #include <cstdio> 2 #include <cstring> 3 #include <algorithm> 4 using namespace std; 5 #define lson l,m,rt<<1 6 #define rson m+1,r 阅读全文