自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(6)
  • 收藏
  • 关注

原创 【算法题】洛谷 P3958 [NOIP2017 提高组] 奶酪

【题目来源】 [NOIP2017 提高组] 奶酪 - 洛谷 【分析】 看数据规模,T<=20,n<=1e3,则每次询问可以承受O(n^2)。 采用广度优先搜索,把从底部能进入的洞加入队列,并标记vis=1(可到达),然后开始搜索,每个与队列中连通的洞可以加入队列(条件:洞心距离<=2*r),并标记其vis=1。最后判断是否存在这样的洞:(1)能到达顶部(2)vis=1。 特别注意爆int,int数据做运算,每一部分都要强制转换成long long型: ll dist(PO

2021-09-14 21:29:25 231

原创 【算法题】洛谷 P3367 【模板】并查集

【题目来源】 【模板】并查集 - 洛谷 【分析】 #并查集 【代码】 #include<iostream> #include<cstdio> #include<algorithm> #define ll long long using namespace std; const int N=1e4+5; int n,m; int f[N]; int findf(int x){ return x==f[x]?x:f[x]=findf(f[x]); }

2021-09-14 20:26:49 77

原创 【算法题】洛谷 P3374 【模板】树状数组 1

【题目来源】 【模板】树状数组 1 - 洛谷 【分析】 #树状数组 【代码】 #include<iostream> #include<cstdio> #include<algorithm> #define ll long long using namespace std; const int maxn=5e5+5; int n,m; ll sum[maxn]; inline int lowbit(int x){ return x&-x;

2021-09-14 20:12:16 60

原创 【算法题】洛谷 P3366 【模板】最小生成树

【题目来源】 【模板】最小生成树 - 洛谷 【分析】 #最小生成树 #并查集 #前向星存图 #克鲁斯卡尔 【代码】 #include<iostream> #include<cstdio> #include<algorithm> //sort函数 using namespace std; const int N=5000+5; const int M=2e5+5; struct edge{ int u,v,w; }e[M]; int n,m

2021-09-14 13:26:44 58

原创 【算法题】洛谷 P4779 【模板】单源最短路径(标准版)

【题目来源】 【模板】单源最短路径(标准版) - 洛谷 【分析】 #迪杰斯特拉(堆优化) 【代码】 #include<iostream> #include<cstdio> #include<cstring> #include<queue> using namespace std; const int N=1e5+5; const int M=2e5+5; const int INF=1e9+5; struct edge{ int fr

2021-09-13 23:26:22 89

原创 【算法题】洛谷 P1451 求细胞数量

【题目来源】 求细胞数量 - 洛谷 【题目】 【算法】 深度优先搜索(DFS) 【代码】 #include<cstdio> #include<string> #include<iostream> using namespace std; const int dx[]={0,0,1,-1}; const int dy[]={1,-1,0,0}; const int N=100+1; const int M=100+1; int n,...

2021-09-12 22:24:01 132

空空如也

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除