摘要: 题目链接:https://www.luogu.com.cn/problem/P1396 法一:二分+并查集 题目求经过道路的拥挤度最大值最小。我们可以考虑二分。我们就分距离。 L = (边的最小值) R = (边的最大值) 于是我们可以得到 while(l <= r) { mid = (l +r) 阅读全文
posted @ 2021-08-20 10:11 ssdaeda 阅读(37) 评论(0) 推荐(0) 编辑
摘要: 题目推荐:http://ybt.ssoier.cn:8088/problem_show.php?pid=1151 https://www.luogu.com.cn/problem/P3383 第二个题数据规模有点儿doge,所以建议直接用欧拉筛来提交 第一种写法:朴素筛 1.O(n^2)写法 usi 阅读全文
posted @ 2021-08-19 10:50 ssdaeda 阅读(52) 评论(1) 推荐(0) 编辑
摘要: 一:暴力dfs(25分)没有任何优化 #include<bits/stdc++.h> using namespace std; int n,m; int fx[3][2]={{-1,0},{1,0},{0,1}}; int book[1005][1005]; int mp[1005][1005]; 阅读全文
posted @ 2021-07-06 09:56 ssdaeda 阅读(422) 评论(1) 推荐(0) 编辑
摘要: 最近好长时间不更新了,是因为学业负担加重,再加上经常熬夜,马上考试,真是令人头秃(我才不会告诉你们我是懒得写) 题目链接:https://www.luogu.com.cn/problem/P5318 题目描述 小K 喜欢翻看洛谷博客获取知识。每篇文章可能会有若干个(也有可能没有)参考文献的链接指向别 阅读全文
posted @ 2021-03-12 19:58 ssdaeda 阅读(48) 评论(0) 推荐(0) 编辑
摘要: 题目链接:http://ybt.ssoier.cn:8088/problem_show.php?pid=1340 【题目描述】由于先序、中序和后序序列中的任一个都不能唯一确定一棵二叉树,所以对二叉树做如下处理,将二叉树的空结点用·补齐,如图所示。我们把这样处理后的二叉树称为原二叉树的扩展二叉树,扩展 阅读全文
posted @ 2020-12-13 09:17 ssdaeda 阅读(345) 评论(0) 推荐(0) 编辑
摘要: 引:sort函数包含在头文件为#include<algorithm>的c++标准库中,调用标准库里的排序方法可以实现对数据的排序,但是sort函数是如何实现的,我们不用考虑! sort函数的参数: (1)第一个参数first:是要排序的数组的起始地址。 (2)第二个参数last:是结束的地址(最后一 阅读全文
posted @ 2020-11-26 18:25 ssdaeda 阅读(75) 评论(1) 推荐(0) 编辑
摘要: #include<bits/stdc++.h> using namespace std; struct dt{ int cs,bs; }que[210]; int n,a,b,ans=-1; int yd[205]; int book[205]; int f,r; bool fs=false; vo 阅读全文
posted @ 2020-10-06 19:50 ssdaeda 阅读(197) 评论(0) 推荐(0) 编辑
摘要: 本题,我用了两种方法,个人认为DFS要更方便一点,至少从代码量来看是这样的 #include<bits/stdc++.h> using namespace std; struct node{ int x,y; }que[12110]; int fx[8][2]={{-1,0},{-1,1},{0,1 阅读全文
posted @ 2020-10-06 10:56 ssdaeda 阅读(420) 评论(2) 推荐(0) 编辑
摘要: #include<bits/stdc++.h> using namespace std; int ax, ay, bx, by; struct node{ int x, y, step; }; node que[10010]; int f, r; bool book[105][105]; int f 阅读全文
posted @ 2020-10-06 00:03 ssdaeda 阅读(627) 评论(1) 推荐(0) 编辑
摘要: 法一:DFS!!(详细看注释) #include<bits/stdc++.h> using namespace std; int n,m;//行列 char mp[70][70];//地图 int next[4][2]={{-1,0},{1,0},{0,-1},{0,1}};//方向 int ans 阅读全文
posted @ 2020-10-04 21:16 ssdaeda 阅读(287) 评论(2) 推荐(0) 编辑
摘要: 又到了一星期一度的编程课,我们可爱的迷宫来了 首先要走迷宫,先看地图,所以我们需要一个数组来记录我们的迷宫地图 其次,就像键盘上的方向键,上下左右,需要一个数组去控制小X的运动方向 搜索的精髓在于,尽量不走重复的路线,就比如说你向下向上,向下向上。。。。(此处省略n),不还是在原地,所以,就要用一个 阅读全文
posted @ 2020-09-25 21:45 ssdaeda 阅读(715) 评论(1) 推荐(2) 编辑
摘要: 题目链接:http://ybt.ssoier.cn:8088/problem_show.php?pid=1336 #include<bits/stdc++.h> using namespace std; const int N=205; int n,m,x[N],y[N],sum[N],father 阅读全文
posted @ 2020-12-04 20:41 ssdaeda 阅读(88) 评论(0) 推荐(0) 编辑
摘要: vector 1 基本操作 (1)头文件#include<vector>. (2)创建vector对象,vector<int> vec; (3)尾部插入数字:vec.push_back(a); (4)使用下标访问元素,cout<<vec[0]<<endl;记住下标是从0开始的。 (5)使用迭代器访问 阅读全文
posted @ 2020-12-03 18:30 ssdaeda 阅读(103) 评论(0) 推荐(0) 编辑
摘要: 摘要:http://ybt.ssoier.cn:8088/problem_show.php?pid=1970 今日复习:DFS 复习题目:(真题)1970:【15NOIP普及组】扫雷游戏 上代码!!!! #include<bits/stdc++.h> using namespace std; int 阅读全文
posted @ 2020-11-05 17:57 ssdaeda 阅读(319) 评论(0) 推荐(0) 编辑
摘要: #include<bits/stdc++.h> using namespace std; int m, n; char mp[25][25]; int sx, sy, ex, ey; struct node{ //结构体定义位置坐标和起点开始步骤 int x, y, step; }; int dir 阅读全文
posted @ 2020-10-06 20:32 ssdaeda 阅读(302) 评论(0) 推荐(0) 编辑