http://codeforces.com/gym/100801/attachments 题意:给出n-1张不同的票,票价分别为 pi,每张票每次最多可以坐 r 个站(1<=r<n),并且票是可以无限用并且只能买一张,如果坐到限定的距离了,要出站再重新进站,这里要花费 di 的时间(2<=i<=n-1),并且每坐一个站花费 1 min,一个人坐地铁要从第一个站坐到最后一个站,问在规定时间 t 里面可以买到的最低票价是多少. 思路:首先可以确定的是,我们对票价都要进行一次DP,我自己…
Cut the Sequence Time Limit: 2000MS Memory Limit: 131072K Total Submissions: 8764 Accepted: 2576 Description Given an integer sequence { an } of length N, you are to cut the sequence into several parts every one of which is a consecutive subseque…
传送门 就是个单调队列+DP嘛. ——代码 #include <cstdio> ; , t = , ans = ~( << ); int q[MAXN], a[MAXN], f[MAXN]; inline int min(int x, int y) { return x < y ? x : y; } int main() { int i; scanf("%d %d", &n, &m); ; i <= n; i++) scanf(&qu…