摘要: https://www.luogu.com.cn/problem/P2142 #include<bits/stdc++.h> using namespace std; char a[100860],b[100860]; int aa[100860],bb[100860],cc[100860]; in 阅读全文
posted @ 2020-08-22 15:48 zlq, 阅读(83) 评论(0) 推荐(0) 编辑
摘要: https://www.luogu.com.cn/problem/P1601 #include<bits/stdc++.h> using namespace std; string a,b; int aa[1000],bb[1000],cc[1000],lenc; int main() { mems 阅读全文
posted @ 2020-08-22 15:11 zlq, 阅读(141) 评论(0) 推荐(0) 编辑
摘要: http://ybt.ssoier.cn:8088/problem_show.php?pid=1224 类似最大子段和 枚举矩阵的左端点i和右端点j 将每一行的i到j之间的区间和(前缀和求出)视为一个元素,求由它们构成的数列中的最大子段和 时间复杂度o(n^3) #include<bits/stdc 阅读全文
posted @ 2020-08-22 11:37 zlq, 阅读(118) 评论(0) 推荐(0) 编辑
摘要: https://www.luogu.com.cn/problem/P1115 b[i]为以a[i]为结尾的子段中的最大子段和 1. 非空子段: b[i]=max(a[i],b[i-1]+a[i]); 2. 可以为空的子段: b[i]=max(0,a[i],b[i-1]+a[i]); 因为b[i-1] 阅读全文
posted @ 2020-08-22 10:42 zlq, 阅读(101) 评论(0) 推荐(0) 编辑
摘要: http://ybt.ssoier.cn:8088/problem_show.php?pid=1320 #include<bits/stdc++.h> using namespace std; int a[661]; int main() { int n,sum=0,eve,ans=0; cin>> 阅读全文
posted @ 2020-08-21 22:00 zlq, 阅读(124) 评论(0) 推荐(0) 编辑
摘要: https://www.luogu.com.cn/problem/P2363 #include<bits/stdc++.h> using namespace std; int a[2100][2100],dp[2280][2280],f[10111000]; void read(int &x) { 阅读全文
posted @ 2020-08-07 20:50 zlq, 阅读(115) 评论(1) 推荐(0) 编辑
摘要: https://www.luogu.com.cn/problem/P1944 1. 遇到左括号加1右括号减1无法判断【(】)的情况 将括号压入栈中来判断是否合法,左括号直接压进去,右括号与栈顶元素比较,匹配则弹出来,不匹配返回不合法 所有括号都扫完之后记得检查栈是否为空 2. 枚举左端点i,从左往右 阅读全文
posted @ 2020-08-07 11:34 zlq, 阅读(227) 评论(0) 推荐(0) 编辑
摘要: https://www.luogu.com.cn/problem/P1021 爆搜搜邮票面值,完全背包验证 设dp[j]为面值为j时所用最少邮票数,小于总邮票数则合法 #include<bits/stdc++.h> using namespace std; int n,k,dp[10010],ans 阅读全文
posted @ 2020-08-06 16:28 zlq, 阅读(123) 评论(0) 推荐(0) 编辑
摘要: https://www.luogu.com.cn/problem/CF460C 二分答案+差分 #include<bits/stdc++.h> using namespace std; long long n,m,w,a[1000000],l=0,r=1e10,sum[1000000],aa[100 阅读全文
posted @ 2020-08-05 20:46 zlq, 阅读(113) 评论(0) 推荐(0) 编辑
摘要: https://www.luogu.com.cn/problem/CF845C 差分+离散化 #include<bits/stdc++.h> using namespace std; int a[700100],s[700100],se[700100],e[700100];//2*n的范围 int 阅读全文
posted @ 2020-08-05 17:26 zlq, 阅读(142) 评论(0) 推荐(0) 编辑