02 2022 档案
摘要:
P2678 [NOIP2015 提高组] 跳石头(二分答案): #include<bits/stdc++.h> using namespace std; int n,a[50005],mid,m,ll; bool check(int x) { int sum=0,ji,i=0; while(i<=n
阅读全文

摘要:
P3367 【模板】并查集: #include<bits/stdc++.h> #define for1(i,a,b) for(int i = a;i <= b;i++) using namespace std; int m,n,a[500000]; int zhao(int x) { if(x ==
阅读全文

摘要:
P3378 【模板】堆 #include<bits/stdc++.h> #define for1(i,a,b) for(int i = a;i<=b;i++) using namespace std; int d[5000005],tail; void put(int x) { int now=++
阅读全文

摘要:
P3375 【模板】KMP字符串匹配(看毛片): #include<bits/stdc++.h> #define for1(i,a,b) for(int i = a;i<=b;i++) #define mp(a,b) make_pair(a,b) using namespace std; int n
阅读全文

摘要:
P1020 [NOIP1999 普及组] 导弹拦截(LIS) LIS:最长单调上升子序列 lis 似乎没有裸的原题,这道题相当于求一个最长单调下降子序列和一个最长单调不降子序列,而且必须要 的做法才能过 (求需要多少套系统相当于此时使用了 套系统,在拦截第
阅读全文

摘要:
NIM游戏: n堆石子,每堆数量{a1,a2,a3...an},每次移动是在一个石堆中取走任意数量(至少一个)的石子,当轮到的一方所有的石子堆都是空的时,判负。 先引入一个东西 判定引理: 终局为必败局面(a1=a2=a3=...an=0)。 对于任意必胜局面,都存在一种合法的必败局面。(你不按必胜
阅读全文

摘要:P1048 [NOIP2005 普及组] 采药(01背包): #include<bits/stdc++.h> using namespace std; int m,bag,dp[100005],t,w; int main() { scanf("%d%d",&bag,&m); for(int i =
阅读全文