随笔分类 -  ACM

摘要:Dinic模板 上界O(N*M2) 二分图用 #pragma GCC optimize(2) #include <bits/stdc++.h> using namespace std; const int maxn = 1e6 + 10; const int maxm = 1e5 * 2 + 10; 阅读全文
posted @ 2020-07-25 21:53 ViKyanite 阅读(82) 评论(0) 推荐(0) 编辑
摘要:二分图最大匹配: hopcroft-carp算法 O(sqrt(n)m) (算是改进版的匈牙利算法吧 #include <bits/stdc++.h> using namespace std; const int maxn = 501; const int maxm = 250001; const 阅读全文
posted @ 2020-07-14 19:48 ViKyanite 阅读(127) 评论(0) 推荐(0) 编辑
摘要:这个模板是我在某谷上看到的。觉得写得挺有通用性得,就嫖过来的。 原博客网址。 //整数二分答案 while(left <= right) { int mid = (left + right) / 2; if(judge(mid)) { left = mid + 1; ans = max(ans, m 阅读全文
posted @ 2020-07-04 10:36 ViKyanite 阅读(125) 评论(0) 推荐(0) 编辑
摘要:数论: 快速乘: ll ModMul(ll a,ll b,ll n){//快速积取模 a*b%n ll ans=0; while(b){ if(b&1) ans=(ans+a)%n; a=(a+a)%n; b>>=1; } return ans; } 快速幂: ll ModExp(ll a,ll b 阅读全文
posted @ 2020-06-13 21:51 ViKyanite 阅读(190) 评论(0) 推荐(0) 编辑
摘要:链式前项星: struct E { int to, w, next; }edge[N]; //这里千万要注意,如果题目是双向边的话,这里的N要开2*N int tot, head[N]; //加边 inline void add_edge(int u, int v, int w) { edge[to 阅读全文
posted @ 2020-05-25 18:30 ViKyanite 阅读(225) 评论(0) 推荐(0) 编辑
摘要:传送门(problem_link) 这道题目就是很普通的一道水题,容易错的点可能就是题目问你是最少要拆多少礼物。 ((()()(B)))这样的话最少应该是3个才对 当拆到()()(B)的时候直接拆有B的就行了,因为题目求的是最少 所以这道题的解题思路就是一直读,遇到"( "入栈,遇到" )"出栈,遇 阅读全文
posted @ 2019-08-16 17:41 ViKyanite 阅读(111) 评论(0) 推荐(0) 编辑

点击右上角即可分享
微信分享提示
主题色彩