摘要:
cdq分治+单调栈+二分 对y分治,单调栈上部维护递增,下部递减,因为一旦一个点不满足单调性了,就会把前面的点卡掉,所以在单调栈里干掉那些点 #include<bits/stdc++.h> using namespace std; typedef long long ll; const int N 阅读全文
摘要:
树状数组+离线 按x排序,y离散化,树状数组查询,跟逆序对一样 #include<bits/stdc++.h> using namespace std; const int N = 500010; int n, m, tot, lim; vector<int> v; int ans[N], aa[N 阅读全文
摘要:
A 出题人不给样例解释。。。具体程序 #include<bits/stdc++.h> using namespace std; int n; char s[100]; int main() { scanf("%d%s", &n, s + 1); int ans = 0, tot = 0; for(i 阅读全文
摘要:
后缀数组+二分 中间加个字符,然后二分判断即可 #include<bits/stdc++.h> using namespace std; typedef long long ll; const int N = 100010; int n, top, k, tot, m, ans; int a[N], 阅读全文
摘要:
二分+后缀数组 并查集怎么做? 二分长度,然后扫描一遍,如果lcp比值大,那么肯定能满足这个x,因为lcp比x大说明包含长x的lcp #include<cstdio> #include<algorithm> using namespace std; typedef long long ll; con 阅读全文
摘要:
区间dp dp[i][j]存i->j区间的所有取值 然后枚举分割点,枚举两个存的值,分别运算存储。 看见这种不确定分割顺序,两个区间合并的情况,就要用区间dp。 #include<bits/stdc++.h> using namespace std; const int N = 60; int n, 阅读全文