摘要: 题目传送门 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 阅读(107) 评论(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 阅读(192) 评论(0) 推荐(0) 编辑
摘要: 题目传送门 f[i]表示到第i个信徒的最少集体数,ans[i]为最小危险值. #include<iostream> #include<cstdio> #include<cstring> #include<set> using namespace std; int n,m,k,p[1001],f[10 阅读全文
posted @ 2020-09-02 23:30 Mr^Simon 阅读(205) 评论(0) 推荐(0) 编辑
摘要: 题目传送门 f[i][1/0]表示到第i列左右端点的最短路程长度 #include<iostream> #include<cstdio> #include<cstring> #include<cmath> using namespace std; int n,l[20001],r[20001],f[ 阅读全文
posted @ 2020-09-02 23:25 Mr^Simon 阅读(103) 评论(0) 推荐(0) 编辑
摘要: 题目传送门 背包,一个高精度dp #include<iostream> #include<cstdio> #include<cstring> using namespace std; int n,k; struct kkk{ int a[1000],len; kkk() { memset(a,0,s 阅读全文
posted @ 2020-09-02 23:23 Mr^Simon 阅读(173) 评论(0) 推荐(0) 编辑
摘要: 题目传送门 移动一个数可以看做将其删掉,最终保留一个和最大的上升子序列 阅读全文
posted @ 2020-09-02 23:21 Mr^Simon 阅读(124) 评论(0) 推荐(0) 编辑
摘要: 题目传送门 f[i][j][1/0]表示以(i,j)为右下角,当前格子是1/0的最大答案 #include<iostream> #include<cstdio> #include<cstring> using namespace std; int n,m,ans,a[1501][1501],f[15 阅读全文
posted @ 2020-09-02 23:16 Mr^Simon 阅读(154) 评论(0) 推荐(0) 编辑
摘要: 题目传送门 f[i][1/0][1/0]表示到第i列时,第i列是否放,第i-1列是否放的方案数. #include<iostream> #include<cstdio> #include<cstring> using namespace std; int n,a[10001],f[10001][2] 阅读全文
posted @ 2020-09-02 23:14 Mr^Simon 阅读(127) 评论(0) 推荐(0) 编辑
摘要: 题目传送门 dp,f[i][j][k][1/0]表示到(i,j)uim/小a魔瓶里的液体为k(经取模后)的方案数 #include<iostream> #include<cstdio> #include<cstring> using namespace std; int n,m,k,a[801][8 阅读全文
posted @ 2020-09-02 23:11 Mr^Simon 阅读(137) 评论(0) 推荐(0) 编辑
摘要: 题目传送门 数位dp #include<iostream> #include<cstdio> #include<cstring> using namespace std; long long n,f[70][2][70]; long long s[70],len,mod = 10000007; in 阅读全文
posted @ 2020-09-02 23:07 Mr^Simon 阅读(132) 评论(0) 推荐(0) 编辑
摘要: 题目传送门 数位dp #include<iostream> #include<cstdio> #include<cstring> using namespace std; long long a,b,f[20][2][200][205]; int s[25],len; inline long lon 阅读全文
posted @ 2020-09-02 23:06 Mr^Simon 阅读(94) 评论(0) 推荐(0) 编辑
摘要: 题目传送门 数位dp #include<iostream> #include<cstdio> #include<cstring> using namespace std; int l,r,s[101],len; int f[100][2][2][100][100]; inline void fenj 阅读全文
posted @ 2020-09-02 23:05 Mr^Simon 阅读(93) 评论(0) 推荐(0) 编辑
摘要: 题目传送门 数位dp. #include<iostream> #include<cstdio> #include<cstring> #define mod 1000000007 using namespace std; string l,r; int a[1005],b[1005],f[1005][ 阅读全文
posted @ 2020-09-02 23:04 Mr^Simon 阅读(91) 评论(0) 推荐(0) 编辑
摘要: 题目传送门 数位dp,没啥好说的 #include<iostream> #include<cstdio> #include<cstring> #define mod 1000000007 using namespace std; int t,s[20],len; long long l,r,ans, 阅读全文
posted @ 2020-09-02 22:59 Mr^Simon 阅读(124) 评论(0) 推荐(0) 编辑
摘要: 题目传送门 从最后倒着往前推,贪心模拟即可 #include<iostream> #include<cstdio> #include<vector> #include<queue> using namespace std; int m,n,ti,o[501],ans; vector<int> a[5 阅读全文
posted @ 2020-09-02 22:58 Mr^Simon 阅读(149) 评论(0) 推荐(0) 编辑
摘要: 题目传送门 一开始没看到题目下面的说明(只能走直线),推了好长时间没推出来.f[i][j]表示从(0,0)到(i,j)的最大矿数. #include<iostream> #include<cstdio> #include<cstring> using namespace std; int n,m,a 阅读全文
posted @ 2020-09-02 22:54 Mr^Simon 阅读(76) 评论(0) 推荐(0) 编辑
摘要: 题目传送门 区间DP,f[i][j]表示i~j区间最小答案,用ans[i][j]记录f[i][j]的断点在哪里,即括号分界处. #include<iostream> #include<cstdio> #include<cstring> #include<algorithm> using namesp 阅读全文
posted @ 2020-09-02 21:43 Mr^Simon 阅读(101) 评论(0) 推荐(0) 编辑
摘要: 题目传送门 分层图最短路,或者说是一个DP,f[i][j]表示用了i张免费券,到了j号点的最小花费,然后跑最短路 #include<iostream> #include<cstdio> #include<cstring> #include<queue> using namespace std; in 阅读全文
posted @ 2020-09-02 21:14 Mr^Simon 阅读(168) 评论(0) 推荐(0) 编辑