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