• 博客园logo
  • 会员
  • 周边
  • 新闻
  • 博问
  • 闪存
  • 众包
  • 赞助商
  • Chat2DB
    • 搜索
      所有博客
    • 搜索
      当前博客
  • 写随笔 我的博客 短消息 简洁模式
    用户头像
    我的博客 我的园子 账号设置 会员中心 简洁模式 ... 退出登录
    注册 登录
Codjjj
博客园 | 首页 | 新随笔 | 新文章 | 联系 | 订阅 订阅 | 管理
上一页 1 2 3 4 5 下一页

2021年9月6日

次小生成树
摘要: 一本通:秘密的牛奶运输 次小生成树经典做法总结 定义: 严格次小生成树:生成树权值之和的第二小的数值的树 非严格次小生成树:生成树权值之和的数值第二小的的树 Sol1:(既可以求严格最小生成树,也可以求非严格) 先做一遍最小生成树,枚举每一条非树边,加上这条边,便形成了一个环,再去掉环上权值最大的一 阅读全文
posted @ 2021-09-06 23:35 _Codjjj 阅读(62) 评论(0) 推荐(0)
 
 

2021年9月2日

Kruskal维护连通块个数
摘要: 一本通 Kruskal维护连通块个数 本题一个关键而巧妙的点是想这个卫星要建在哪个点上,我们可以发现,d=+∞时,卫星k=0,k>=n时,d=0,再分析可知,d越大,k越小,由此我们想到二分d,看当前需要的k是不是小于题目给的k 但是怎么得到这个“当前需要的k”呢?答案是考虑当前的连通块数量,比如现 阅读全文
posted @ 2021-09-02 17:09 _Codjjj 阅读(55) 评论(0) 推荐(0)
 
 

2021年9月1日

经典题:map写bfs
摘要: #include<bits/stdc++.h> #define x first #define y second using namespace std; int order[8] = { 4,1,2,3,6,7,8,5 }; int order2[8] = { 1,7,2,4,5,3,6,8 }; 阅读全文
posted @ 2021-09-01 11:32 _Codjjj 阅读(44) 评论(0) 推荐(0)
 
分为互斥组
摘要: #include<bits/stdc++.h> using namespace std; const int N = 15; int n; int p[N]; int res = N; int group[N][N]; bool st[N]; int gcd(int x, int y) { retu 阅读全文
posted @ 2021-09-01 11:31 _Codjjj 阅读(87) 评论(0) 推荐(0)
 
莫队+离散化
摘要: #include<bits/stdc++.h> #define ll long long using namespace std; const int N=3e5,M=5e5; int n,m,k,maxn; int a[N],b[N],c[N]; ll num[N]; ll curn; int p 阅读全文
posted @ 2021-09-01 11:30 _Codjjj 阅读(33) 评论(0) 推荐(0)
 
三进制状压dp
摘要: #define _CRT_SECURE_NO_WARNINGS #include<bits/stdc++.h> #define ull unsigned long long using namespace std; const int INF = 0x3f3f3f3f,M=27*27*27-1; i 阅读全文
posted @ 2021-09-01 11:29 _Codjjj 阅读(61) 评论(0) 推荐(0)
 
模板:树状数组
摘要: #include<bits/stdc++.h> using namespace std; const int N=500; int a[N]; int ask(int x){ int ans=0; for(;x;x-=x&-x)ans+=a[x],x-=x&-x; return ans; } voi 阅读全文
posted @ 2021-09-01 11:27 _Codjjj 阅读(29) 评论(0) 推荐(0)
 
最短路输出路径
摘要: #include<bits/stdc++.h> #define x first #define y second using namespace std; typedef pair<int,int> PII; const int N=1010; int n; int g[N][N]; PII pre 阅读全文
posted @ 2021-09-01 11:26 _Codjjj 阅读(45) 评论(0) 推荐(0)
 
Kruskal的经典扩展
摘要: acw348 Kruskal的经典扩展 题意:将一棵树扩展成一个完全图,保证该树是图的唯一最小生成树 关键思想:将一棵树看成是点集由集合合并组成的,每一次集合合并,都建构两个集合之间除树边以外的图边,由Kru算法的原来可知,最短的图边长度是w+1; Code: #include<bits/stdc+ 阅读全文
posted @ 2021-09-01 08:48 _Codjjj 阅读(48) 评论(0) 推荐(0)
 
 

2021年8月31日

快速幂+最短路+DP
摘要: 快速幂+最短路+DP acw347 Code: #include<bits/stdc++.h> using namespace std; const int N = 210,M=110,INF=0x3f3f3f3f; int n, m; int g[N][N],res[N][N];//初始时g表示的 阅读全文
posted @ 2021-08-31 09:24 _Codjjj 阅读(32) 评论(0) 推荐(0)
 
 
上一页 1 2 3 4 5 下一页

公告


博客园  ©  2004-2025
浙公网安备 33010602011771号 浙ICP备2021040463号-3