AcWing 1106 山峰和山谷 BFS
发布时间
阅读量:
阅读量
AcWing 1106 山峰和山谷
有关BFS的应用题目,需要重点掌握新学习的关于连通块与边界的对比分析方法,同时要特别留意山谷与山峰中has_higher和has_lower这两个参数的具体含义,避免在实际操作中混淆山谷与山峰的概念。
#include<bits/stdc++.h>
using namespace std;
const int N = 1010;
#define x first
#define y second
typedef pair<int, int>PII;
int n;
PII q[N * N];
bool st[N][N];
int h[N][N];
void bfs(int sx, int sy, bool& has_higher, bool& has_lower){
st[sx][sy] = true;
int hh = 0, tt = 0;
q[0] = {sx, sy};
while(hh <= tt){
PII t = q[hh
全部评论 (0)
还没有任何评论哟~
