
BFS
hbulzh
这个作者很懒,什么都没留下…
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
牛客网 瞎位移群岛
#include<iostream> #include <cstring> #include <algorithm> #include <queue> using namespace std; const int N = 2e3 + 10; int flag[N]; int id[N][N]; pair<int, int> inputs[N]; int n, m, k, s, t; int d[4][2] = {0, 1, 0, -1, -1,.原创 2021-09-10 00:09:03 · 203 阅读 · 0 评论 -
CCF CSP 2019-12-05 魔数
BFS搜出所有转移状态 然后+线段树+懒标记+__int128乘法运算+ 动态规划优化build函数的节点初始化 少了任何一个优化都过不去 一个优化都不少也有可能过不去,时间卡的太极限了,可能还有极致的优化... #include <bits/stdc++.h> #define ull unsigned long long using namespace std; const ull mod = 2009731336725594113; const int N = 1e6+10; u原创 2020-08-13 15:44:15 · 852 阅读 · 1 评论 -
POJ 1324 BFS+二进制状态标记
STL容器开在函数体内和体外还能卡超时?涨姿势了 #include<iostream> #include<cstring> #include<queue> using namespace std; const int maxr = 30, maxc = 30; int maze[maxr][maxc],vis[maxr][maxc][1<<15...转载 2019-12-25 11:49:11 · 159 阅读 · 0 评论 -
POJ 1376 bfs
建图的方式有点特别,建在 方格的四个顶点处 vis三维数组,第三维记录走过节点的方向 #include<cstdio> #include<cstring> #include<queue> #include<algorithm> #include<map> const int maxn = 1e2+10; using namespac...原创 2019-12-17 20:43:21 · 142 阅读 · 0 评论 -
POJ1475 双bfs 找最短路
第一层bfs找箱子移动的最短路,第二层找人到箱子后边位置的最短路。 难点可能是第一层bfs的vis数组需要开三维,需要同时记录走过点的方向。 其实字符串的处理,路径输出也很恶心。。。属于稍微有点错就得调半天那种 #include<iostream> #include<algorithm> #include<cstdio> #include<cstr...原创 2019-12-16 20:43:22 · 279 阅读 · 0 评论