2023年4月16日
摘要: https://www.luogu.com.cn/problem/UVA1392 给定两个长度为 n 的字符串 A 和 B,满足 A 和 B 都只由大写字母 A、C、G、T 组成。 求一个长度最长的闭区间 [L,R],满足对于 i∈[L,R] , 有不超过 p% 的 i 满足 Ai≠Bi 阅读全文
posted @ 2023-04-16 23:20 towboat 阅读(17) 评论(0) 推荐(0)
摘要: 找最长的,没有相同元素的区间 双指针 #include <iostream> #include <set> using namespace std; const int N=1e6+2; int n,a[N]; void solve(){ int x=1,y=1,ans=0; set<int> st 阅读全文
posted @ 2023-04-16 22:48 towboat 阅读(7) 评论(0) 推荐(0)
摘要: 二分平均值x,每个数减去x , 找区间 S[ r ]- S[l]>=0 ,r-l>=m #include <iostream> #include <vector> #include <algorithm> using namespace std; const int N=1e5+5; #define 阅读全文
posted @ 2023-04-16 17:35 towboat 阅读(12) 评论(0) 推荐(0)
摘要: 一个集合中需要找到 a,b,c,d ,使得 a+b+c=d 枚举a,b ,计算a+b,存在map里 再枚举d,c ,计算d-c 是否 存在 d-c==a+b #include <iostream> #include <map> #include <algorithm> #include <vecto 阅读全文
posted @ 2023-04-16 15:53 towboat 阅读(16) 评论(0) 推荐(0)
摘要: 求 n×n 的环状方阵上的最大子矩阵和。 构造 2*n *( 2*n) 的正方形 求余的一个操作 x''= (x-1)%n+1 #include <iostream> #include <cstring> #include <algorithm> using namespace std; const 阅读全文
posted @ 2023-04-16 12:56 towboat 阅读(9) 评论(0) 推荐(0)
摘要: bug: 前缀和不要写错啊啊, 比如 s[r]-s[l-1] #include <iostream> #include <cstring> #include <algorithm> using namespace std; const int N=4202; int mod ; int f[N][N 阅读全文
posted @ 2023-04-16 02:40 towboat 阅读(12) 评论(0) 推荐(0)