上一页 1 ··· 24 25 26 27 28 29 30 31 32 ··· 41 下一页
摘要: 传送门 由于 Di 只有 3 种情况,那么就很简单了 f[i][j][0] 表示前 i 个,且第 i 个变成 j 的 递增序列最小修改次数 f[i][j][1] 表示前 i 个,且第 i 个变成 j 的 递减序列最小修改次数 状态转移看代码。 ——代码 1 #include <cstdio> 2 # 阅读全文
posted @ 2017-05-26 11:12 zht467 阅读(259) 评论(0) 推荐(0)
摘要: 传送门 f[i] 表示送前 i 头牛过去再回来的最短时间 f[i] = min(f[i], f[j] + sum[i - j] + m) (0 <= j < i) ——代码 1 #include <cstdio> 2 #include <iostream> 3 4 const int MAXN = 阅读全文
posted @ 2017-05-26 10:45 zht467 阅读(102) 评论(0) 推荐(0)
摘要: 传送门 按价格排序后贪心 ——代码 1 #include <cstdio> 2 #include <iostream> 3 #include <algorithm> 4 5 int n; 6 long long m, ans; 7 struct node 8 { 9 long long x, y; 阅读全文
posted @ 2017-05-26 10:27 zht467 阅读(154) 评论(0) 推荐(0)
摘要: 传送门 f[i] 表示前 i 个字符去掉多少个 的最优解 直接暴力DP ——代码 1 #include <cstdio> 2 #include <cstring> 3 #include <iostream> 4 5 int n, m, cnt, f[301]; 6 char s[301], a[60 阅读全文
posted @ 2017-05-26 09:44 zht467 阅读(193) 评论(0) 推荐(0)
摘要: 传送门 转化成 lis 后 n2 搞就行 ——代码 1 #include <cstdio> 2 #include <iostream> 3 #include <algorithm> 4 5 int n, max, ans; 6 int f[10001]; 7 struct node 8 { 9 in 阅读全文
posted @ 2017-05-25 18:34 zht467 阅读(194) 评论(0) 推荐(0)
摘要: 传送门 只有第一个,第二个权限题。 分块,然而wa,没看出来错在哪里,有时间再看。 1 #include <cmath> 2 #include <cstdio> 3 #include <iostream> 4 #include <algorithm> 5 6 const int N = 10001, 阅读全文
posted @ 2017-05-25 16:57 zht467 阅读(126) 评论(0) 推荐(0)
摘要: 是时候结束这个局面了。。 说真的,有了模板一切都好说。 A+B 1 #include <cstdio> 2 #include <cstring> 3 #include <iostream> 4 5 using namespace std; 6 7 const int MAXN = 10001; 8 阅读全文
posted @ 2017-05-25 08:01 zht467 阅读(185) 评论(0) 推荐(0)
摘要: 传送门 单调栈大水题 l[i] 表示 i 能扩展到的左边 r[i] 表示 i 能扩展到的右边 ——代码 1 #include <cstdio> 2 #include <iostream> 3 #define LL long long 4 5 const int MAXN = 2000002; 6 i 阅读全文
posted @ 2017-05-24 20:09 zht467 阅读(146) 评论(0) 推荐(0)
摘要: 传送门 有向图,找点数大于1的强连通分量个数 ——代码 1 #include <stack> 2 #include <cstdio> 3 #include <cstring> 4 #include <iostream> 5 6 const int MAXN = 50001; 7 int n, m, 阅读全文
posted @ 2017-05-24 19:29 zht467 阅读(133) 评论(0) 推荐(0)
摘要: 传送门 首先,把A和B两个序列分别从小到大排序,变成两个有序队列。这样,从A和B中各任取一个数相加得到N2个和,可以把这些和看成形成了n个有序表/队列: A[1]+B[1] <= A[1]+B[2] <= … <= A[1]+B[N] A[2]+B[1] <= A[2]+B[2] <= … <= A 阅读全文
posted @ 2017-05-24 18:53 zht467 阅读(184) 评论(0) 推荐(0)
上一页 1 ··· 24 25 26 27 28 29 30 31 32 ··· 41 下一页