摘要:
对于这个dp转移方程,我们观察到的是每个点都从左上方转移或者上方转移。 如果从左上方转移,那么多了一个b[i],可见我们对于每一行在第几列,就能获得几个b[i],那么这其实就是求区间的前k大值和 这就是主席树模板题 #include<bits/stdc++.h> using namespace st 阅读全文
摘要:
套路题,对于步长大于根号n的,直接暴力做,对于步长小于根号n的,保留离线后 对于每个步长for一遍,这样复杂度也是n*根号n #include<bits/stdc++.h> using namespace std; typedef long long ll; typedef pair<int,int 阅读全文
摘要:
这道题的原理是普通的二维差分和二维前缀和,但是因为不能开二维数组,因此映射到一维就行 #include<bits/stdc++.h> using namespace std; typedef long long ll; const int N=1e7+10; const int mod=1e9+7; 阅读全文
摘要:
一个经典套路是异或前缀和公式,因此我们可以枚举右端点,寻找异或值大于等于k的答案 做完后每次把前缀和放到trie树上面去。 #include<bits/stdc++.h> using namespace std; typedef long long ll; const int N=1000005; 阅读全文
摘要:
C 分类讨论+思路 #include<bits/stdc++.h> using namespace std; typedef long long ll; const int N=1e6+10; string s,t; int a[N]; vector<int> num; #define mp mak 阅读全文