上一页 1 2 3 4 5 6 7 8 9 ··· 37 下一页
摘要: ##题目传送门 类比最长公共子序列,$f_{i,j,k}$表示到$A_i,B_j,C_k$的最大答案,然后跟最长公共自序列一样转移即可 #include<iostream> #include<cstdio> #include<cstring> using namespace std; string 阅读全文
posted @ 2020-09-12 21:36 Mr^Simon 阅读(161) 评论(0) 推荐(0)
摘要: ##题目传送门 $f_{i,j}\(表示以\)(i,j)$为左下角能得到的最大正方形的边长. #include<iostream> #include<cstdio> #include<cstring> using namespace std; int n,t,f[1001][1001],ans; b 阅读全文
posted @ 2020-09-12 21:29 Mr^Simon 阅读(96) 评论(0) 推荐(0)
摘要: ##题目传送门 源点到i单位的连容量为$r_i$的边,单位到每个餐桌连容量为1的边,餐桌j到汇点连容量为$c_j$的边,跑最大流 #include<iostream> #include<cstdio> #include<cstring> #include<vector> #include<queue 阅读全文
posted @ 2020-09-12 21:26 Mr^Simon 阅读(110) 评论(0) 推荐(0)
摘要: ##题目传送门 源点向每个英国飞行员连容量为1的边,英国飞行员向每个外籍飞行员连容量为inf的边,外籍飞行员向汇点连容量为1的边,跑最大流. #include<iostream> #include<cstdio> #include<cstring> #include<queue> #include< 阅读全文
posted @ 2020-09-12 21:17 Mr^Simon 阅读(75) 评论(0) 推荐(0)
摘要: ##题目传送门 板子不解释 #include<iostream> #include<cstdio> #include<cstring> #include<queue> #include<vector> #define pd(i) (i % 2 == 1) ? i + 1 : i - 1 #defin 阅读全文
posted @ 2020-09-12 21:12 Mr^Simon 阅读(79) 评论(0) 推荐(0)
摘要: ##题目传送门 分别f[i][1/0]表示到第i位从前面或从后面子序列的最大和,最后枚举断点即可. #include<iostream> #include<cstdio> #include<cstring> using namespace std; int n; long long f[100000 阅读全文
posted @ 2020-09-12 21:09 Mr^Simon 阅读(144) 评论(0) 推荐(0)
摘要: ##题目传送门 ##题目传送门2 f[i]表示到第i位最少要删的字符数,对于每个i,将其作为最后一位向前跟w个单词匹配,如果向前匹配到第k位,那就用f[k-1]转移,在匹配过程中记录需要删去元素的个数. #include<iostream> #include<cstdio> #include<cst 阅读全文
posted @ 2020-09-12 20:57 Mr^Simon 阅读(91) 评论(0) 推荐(0)
摘要: ##题目传送门 期望dp,f[i]表示到第i位,1~n的期望收益. 对于每一位,如果操作成1,那收益就会变成: \((x+1)^3 = (x+1)^2(x+1) = (x^2+2x+1)(x+1) = x^3+3x^2+3x+1\) 显然我们在这一位获得的收益为$3x^2+3x+1$,不难发现,这是 阅读全文
posted @ 2020-09-06 22:08 Mr^Simon 阅读(92) 评论(0) 推荐(0)
摘要: 题目传送门 RMQ模板题,st表分分钟AC #include<iostream> #include<cstdio> #include<cstring> #include<cmath> using namespace std; int m,n,f[100001][30],l,r; int main() 阅读全文
posted @ 2020-09-02 23:36 Mr^Simon 阅读(114) 评论(0) 推荐(0)
摘要: 题目传送门 先跑dfs,枚举出所有符合题意的符号放置方式,再跑区间dp. #include<iostream> #include<cstdio> #include<cstring> using namespace std; int n,k,a[20],p[30]; long long ans,f[2 阅读全文
posted @ 2020-09-02 23:33 Mr^Simon 阅读(254) 评论(0) 推荐(0)
上一页 1 2 3 4 5 6 7 8 9 ··· 37 下一页