![](https://img-blog.csdnimg.cn/20201014180756926.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
动态规划
文章平均质量分 76
BryantMark
这个作者很懒,什么都没留下…
展开
-
SGU 473
/* ID: BryatnMark LANG: JAVA TASK: AC */ import java.util.*; import java.io.*; import java.math.*; import java.util.*; public class Solution { public static void main(String args[]) throws Exceptio原创 2013-05-17 13:01:40 · 532 阅读 · 0 评论 -
lightoj 1316 状态压缩求解汉密尔顿通路
状态压缩求解汉密尔顿通路,首先要求经过的点尽可能多,其次要求路径尽可能短,枚举每种通路状态以及通路终点,借助预处理好的最短路求解答案 #include #include #include #include #include #include #include #include #include #include #include #include using name原创 2013-03-08 19:54:27 · 804 阅读 · 0 评论 -
ZOJ Problem Set - 3694
#include #include #include #include #include #include using namespace std; typedef long long ll; template T ABS(T n) { return n>0?n:-n; } const int maxn = 111111; const ll INF = (1ll<<62); int a[maxn原创 2013-05-14 23:00:56 · 368 阅读 · 0 评论 -
poj 2018
#include #include #include #include #include #include #include #include #include #include using namespace std; typedef vector VI; typedef vector VVI; typedef vectorVVVI; typedef long long LL; const in原创 2013-05-15 00:16:20 · 406 阅读 · 0 评论 -
POJ System
/* ID: BryatnMark LANG: JAVA TASK: AC */ import java.util.*; import java.io.*; import java.math.*; import java.util.*; public class Main { public static void main(String args[]) throws Exception {原创 2013-05-31 08:29:34 · 410 阅读 · 0 评论 -
poj 3017
单调队列优化 单调队列 维护 最大值 队列首元素对应的DP 值 为 dp[low-1] + a[q[front]] 其余元素对应的值(设该元素为q[k]) dp[q[k-1]]+a[q[k]]; Treap 维护下最小值就行了。 #include #include #include #include #include #include #include #include #原创 2013-07-03 22:10:43 · 437 阅读 · 0 评论 -
Codeforces Round #210 (Div. 1) problem C Levko and Strings
极好的一道动态规划, 给定一个小写字母的字符串 S, 求其相同长度的子串T,T中恰包含K个子串字典序大于S中相同位置的子串,求T有几种,记 DP[ i ] [ j ][ 2 ] 为 第i个位置为止已有J个子串字典序大于S中相对应为止的子串,最后一维表示相同与否,我在这里用0表示相同,及T[i][=s[i],否则T[i]!=s[i] 我固定位置i, 向前遍历 当到达位置t时, 令 (S[t]原创 2013-11-12 20:27:09 · 796 阅读 · 3 评论