随笔分类 - 线性dp
摘要:problemsolutioncodes#include#includeusing namespace std;const int maxn = 1010;int m, n, f[maxn][maxn];int main(){ cin>>m>>n; for...
阅读全文
摘要:problemsolutioncodes//f[i]:第i秒最远可以走多远#includeusing namespace std;const int maxn = 300010;int m, s, t, f[maxn];int main(){ cin>>m>>s...
阅读全文
摘要:problemsolutioncodes#include #include #include #include using namespace std;const int M=505;int n,la,lb,a[M],b[M],ans=0;int f[M];void ...
阅读全文
摘要:problemsolutioncodes//f[i][j]:从(i,j)出发能获得的最大值 _裸DFS#include#includeusing namespace std;int n, a[110][110], f[110][110];int dfs(int i, ...
阅读全文
摘要:problemsolutioncodes//f[i]:到第i条线段为止能获得的最大价值//f[i]=max{s[i].c,f[j]+s[i].c|j#includeusing namespace std;const int maxn = 1010;struct seg...
阅读全文
摘要:problemsolutioncodes//f[i][j]:以(i,j)为终点的最长路是是多少//f[i][j] = f(它四周的比他高的方块的最长路)+1#include#includeusing namespace std;const int maxn = 110...
阅读全文
摘要:problemsolutioncodes//多少个最长不上升子序列可以覆盖这个数列,其实是等效于最长上升子序列的长度#include#includeusing namespace std;int n, h[50], k[50], ans1, ans2 = 1;int ...
阅读全文
摘要:problemsolutioncodes#includeusing namespace std;int h[110],f[110],f2[110], ans;int main(){ int n; cin>>n; for(int i = 1; i >h[i]...
阅读全文
摘要:problem占坑待填solution占坑待填???codes//交前%一下, 送你80分#include#includeusing namespace std;const int maxn = 30000010;#define mod 23301int l, s, ...
阅读全文
摘要:题面以一个长为n的数列,求连续子段的最大值。思路1直接枚举O(n^3)TLE稳稳的#includeusing namespace std;int n, a[50050], ans;int main(){ cin>>n; for(int i = 1; i >...
阅读全文
摘要://f[i]:长为i的LIS末位的最小值#include#include#includeusing namespace std;int f[1000010];int main(){ memset(f,0x3f,sizeof(f)); int n; cin...
阅读全文
摘要:0x01题面给定一个长为n的序列,求它的最长上升子序列。 n<103" role="presentation" style="position: relative;">nf[i-1]才成立。 转移: (e)如何得到长为i的LIS的末位最小值{1.找到后面第一个比...
阅读全文