04 2022 档案
摘要:这种搜索树dfs就是一层一层来看,如果这一层的情况考虑结束了之后也就是都没有解了的时候,就开始回溯,回到上一层再判断,一定要记得回溯要恢复现场,先恢复现场再回溯,就是新的一层不能有任何标记这一题不能走过重复的点,回溯的时候相当于换另一种选择的方式,原来标记过的点就需要把标记去掉上一题单词接龙,每个单
阅读全文
摘要:下一阶段的计划:(不要和别人比,要根据自己的实际情况来制定计划,和自己比) 不要自找焦虑,只要完成自己的目标就可以很开心了,每个人有不同的情况,不能上纲上线,生搬硬套!! 5.31之前学完提高课,6.15号之前做完全部的算法进阶:在这里要是遇到之前忘记的知识点,一定要去基础课再磨,现在就是一个慢慢磨
阅读全文
摘要:https://www.acwing.com/activity/content/code/content/3329525/ 这个题宽搜+图论变形+最短路的结合,好题 非特殊点可以匹配四个方向,分别是左上,左下,右上,右下,一个点到这些方向只能是\//\,如果匹配成功边权是0,不匹配就说明需要转化开关
阅读全文
摘要:P2298 Mzc和男家丁的游戏 - 洛谷 | 计算机科学教育新生态 (luogu.com.cn) 意思就是给两个点,之间的最小距离 这个里面用不同的字符表示两个点,所以在条件判断的时候不能写==而是写不等于墙 #include<iostream> #include<cstring> #includ
阅读全文
摘要:P1332 血色先锋队 - 洛谷 | 计算机科学教育新生态 (luogu.com.cn) 题意就是给你很多个源头,看看每个领主传播到的最少时间 标准的多源bfs,只想说y总yyds! #include<iostream> #include<queue> #include<cstring> using
阅读全文
摘要:P1439 【模板】最长公共子序列 - 洛谷 | 计算机科学教育新生态 (luogu.com.cn) 这题按照朴素版本必超时 所以要先离散转化+LIS的二分优化才能过这个题 具体的看题解 #include<iostream> #include<map> using namespace std; co
阅读全文
摘要:Problem Detail - 【提高】方格取数 - 追梦算法网 #include<iostream> using namespace std; int n,m,s; const int N=5050; int g[N][N]; int res; int dx[4]={0,0,1,-1}; int
阅读全文
摘要:蓝桥天梯结束了,怎么说呢,基本上发挥出来的,但争取争取说不定会更好,这个就不纠结了,这就属于是做题策略和平时的功夫没到位,随缘了,下面对自己简单的说一下: 补题:一定要补,学过的知识点一定要补,没学过的记在那边,简单的就补,难的就留着学到的时候写,一定要补题... 思考:自认为自己思维题还行,这个本
阅读全文
摘要:题目详情 - L2-013 红色警报 (25 分) (pintia.cn) #include<iostream> using namespace std; const int N=1e5+10; int p[N]; bool st[N]; struct mess{ int x,y; }v[N]; i
阅读全文
摘要:题目详情 - L2-015 互评成绩 (25 分) (pintia.cn) 结构体排序: #include<iostream> #include<algorithm> using namespace std; const int N=1e5+10; double a[N]; bool cmp(dou
阅读全文
摘要:题目详情 - L2-009 抢红包 (25 分) (pintia.cn) 结构体排序,23分... #include<iostream> #include<algorithm> using namespace std; const int N=1e5+10; struct mess{ double
阅读全文
摘要:题目详情 - L2-008 最长对称子串 (25 分) (pintia.cn) STL:21分,另外的4分超时.. #include<iostream> #include<algorithm> using namespace std; int main(){ string str; getline(
阅读全文
摘要:题目详情 - L2-003 月饼 (25 分) (pintia.cn) 23分,有两分段错误不知道错哪了,不想debug了... #include<iostream> #include<algorithm> using namespace std; const int N=1e5+10; struc
阅读全文
摘要:题目详情 - L2-001 紧急救援 (25 分) (pintia.cn) #include<iostream> #include<cstring> #include<queue> using namespace std; typedef pair<int,int> PAII; int n,m,A,
阅读全文
摘要:这个题本质上是flood fill 变形+记忆化搜索 有m个读入数据,每次bfs或者dfs必然会超时 就把之前已经搜过的点标记一下,然后这个算是01相邻的一个连通块,这个实质上就是求哪一块01连通块里面元素的个数 bfs #include<iostream> #include<cstring> #i
阅读全文
摘要:Problem Detail - 【提高】小X学游泳 - 追梦算法网 也就是上下左右同一个数字的为一个连通块,看看最大的连通块有多大 其实也就是flood fill问题啦 dfs: #include<iostream> using namespace std; int n,m; const int
阅读全文
摘要:和全排列类似,不过不是1开始,是指定的数字开始 Problem Detail - 【递归】n个数的全排列 - 追梦算法网 #include<iostream> #include<algorithm> using namespace std; const int N=15; int a[N],p[N]
阅读全文
摘要:Problem Detail - 关押罪犯 - 追梦算法网 题意就是给你一群罪犯,怨气大的不能在同一个(其实也可以),反正看在同一个集合里面的怨气的最大值 #include<iostream> #include<algorithm> using namespace std; const int N=
阅读全文
摘要:Problem Set - 天梯赛,L2 - 追梦算法网 题意给你城市以及道路,看看至少还要连通多少条道路 求连通块吧然后-1 #include<iostream> using namespace std; const int N=100010; int p[N]; int find(int x)
阅读全文
摘要:Problem Detail - 【基础】卒的遍历 - 追梦算法网 就是从左上到右下,只能向左向下走,输出可以走到的所有的路径 #include<iostream> using namespace std; int n,m; int sum; struct data{ int p,q; }a[110
阅读全文
摘要:有不同的电脑以及文件需要处理 每个电脑都是有限制容量,文档传输也需要一定的时间 每一次输出结果 这个用堆来模拟,优先队列,把最小的提出来,如果右端点<=当前,那之前的处理没啥用,还要还原 如果没有 那就需要兼顾之前的容量 #include<iostream> #include<cstdio> #in
阅读全文
摘要:Problem Detail - H:.完全平方数 - 追梦算法网 题意就是给你一个数n,要求最小的数x使得n*x是一个完全平方数 数据范围很大,到10的12次方 #include<iostream> #include<cmath> using namespace std; typedef long
阅读全文
摘要:一个蛇形矩阵,给你两个数字,求最少的移动距离:只能横着走或竖着走 这个移动的距离好求:横坐标的差+纵坐标的差 #include<iostream> #include<cmath> using namespace std; int main(){ int w,m,n; cin>>w>>m>>n; m-
阅读全文
摘要:https://www.acwing.com/problem/content/1212/ 意思就是给你n个数,看看这n个数能有多少从小到大排序之后可以是连续的 数据范围是10000 像这种暴力的很明显的题不妨去找找其中的规律 连号区间的特点是在一个区间里面,最大值-最小值等于区间的边界相减 其实就可
阅读全文
摘要:https://www.lanqiao.cn/problems/1136/learning/ 意思就是给m个数据,每组里面的x,y对立,求下一个不符合条件的编号 种类并查集: 描述就是 知道了这个之后,这个题就是很好的一个板子入门题 #include<iostream> using namespac
阅读全文
摘要:Mahmoud and a Triangle 给很多根木棍,看能不能从中选三个组合一个三角形 #pragma GCC optimize(1) #pragma GCC optimize(2) #pragma GCC optimize(3,"Ofast","inline") #include<iostr
阅读全文
摘要:https://www.acwing.com/activity/content/code/content/3106996/ 题意就是把一个数变成a+b/c的形式(当然等式肯定是成立的),然后组成abc的数字由1~9分成,不能有重复和遗漏 #include<iostream> #include<alg
阅读全文
摘要:这个就要求没有重复的,可以按照字典序来输出,保证一定后面的数字比前面的数字要大,自然就没有重复的数字了,这个时候连判重也不需要了 https://www.acwing.com/activity/content/record/19/1/ #include<iostream> using namespa
阅读全文
摘要:题目详情 - L1-003 个位数统计 (15 分) (pintia.cn) 给你一个不超过1000位的数字,求每个数字有多少个 #include<iostream> using namespace std; struct js{ int s; }a[10]; int main(){ string
阅读全文
摘要:题目详情 - 7-12 分而治之 (25 分) (pintia.cn) 刚开始确实题目没读懂... 也就是那么多城市给你打,打完之后如果还有连通的城市就失败,否则成功 #include<iostream> #include<vector> #include<cstring> using namesp
阅读全文