随笔分类 -  模板

摘要:Tarjan# P3387 【模板】缩点(强连通分量+拓扑+dp) #include<iostream> #include<queue> #include<cmath> #define for1(i,a,b) for(int i = a;i<=b;i++) #define mp(a,b) make_pair(a 阅读全文
posted @ 2022-09-25 21:51 yyx525jia 阅读(19) 评论(0) 推荐(0) 编辑
摘要:树状数组(单点修改区间查询)(区间修改单点查询)(区间修改区间查询)(2022/9/18)单点修改区间查询 #include<bits/stdc++.h> using namespace std; long long a,tree[10000000*4],n; long long lb(long long x) { return x&-x; } void xg(long long x,l 阅读全文
posted @ 2022-09-18 22:21 yyx525jia 阅读(19) 评论(0) 推荐(0) 编辑
摘要:网络流各种建图方法: https://www.cnblogs.com/birchtree/p/12912607.html P3376 【模板】网络最大流(dicnic+当前弧优化+分层图) #include <bits/stdc++.h> #define for1(i,a,b) for(ll i = a; 阅读全文
posted @ 2022-09-08 22:26 yyx525jia 阅读(7) 评论(0) 推荐(0) 编辑
摘要:杂七杂八(数论)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 阅读全文
posted @ 2022-02-17 11:38 yyx525jia 阅读(19) 评论(0) 推荐(0) 编辑
摘要:图论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 == 阅读全文
posted @ 2022-02-17 11:38 yyx525jia 阅读(13) 评论(0) 推荐(0) 编辑
摘要:数据结构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=++ 阅读全文
posted @ 2022-02-17 11:37 yyx525jia 阅读(10) 评论(0) 推荐(0) 编辑
摘要:字符串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 阅读全文
posted @ 2022-02-17 11:35 yyx525jia 阅读(11) 评论(0) 推荐(0) 编辑
摘要:dpP1020 [NOIP1999 普及组] 导弹拦截(LIS) LIS:最长单调上升子序列 lis 似乎没有裸的原题,这道题相当于求一个最长单调下降子序列和一个最长单调不降子序列,而且必须要 O(nlogn) 的做法才能过 (求需要多少套系统相当于此时使用了 m 套系统,在拦截第 i 阅读全文
posted @ 2022-02-17 11:34 yyx525jia 阅读(146) 评论(0) 推荐(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 = 阅读全文
posted @ 2022-02-17 11:30 yyx525jia 阅读(16) 评论(0) 推荐(0) 编辑

点击右上角即可分享
微信分享提示