随笔分类 -  搜索

cf877D
摘要:题意简述:矩阵中有的点不能走,你每次可从四个方向走,至少走一步,最多走k步(不能横跨那些不能走的格子),问从(sx,sy)走到(tx,ty)的最短时间是多少? 题意:利用set来加速bfs的过程,原理是一个点一旦走过就不需要再去走了,具体看代码 #include <bits/stdc++.h> us 阅读全文

posted @ 2020-02-22 22:57 欣崽 阅读(236) 评论(0) 推荐(0)

CodeForces - 1105D 多源搜索
摘要:#include using namespace std; typedef long long ll; struct node{ int x,y; ll setp; }; queue Q,border[10]; const int maxn=1005; char a[maxn][maxn]; int vis[maxn][maxn]; int n,m,p; ll ans[10],s... 阅读全文

posted @ 2019-03-01 16:27 欣崽 阅读(574) 评论(0) 推荐(0)

导航