救救孩子

P3456 [POI2007] GRZ-Ridges and Valleys

```cpp int kx[10]={1,-1,0,0,1,1,-1,-1}; int ky[10]={0,0,1,-1,1,-1,-1,1}; ``` 不知道是不是这个
by BADFIVE @ 2021-04-06 20:21:48


数组的初始赋值(
by BADFIVE @ 2021-04-06 20:22:58


这个好像搜索有问题(
by BADFIVE @ 2021-04-06 20:24:13


啊啊啊,我再去试一下。谢谢了
by Kiloio @ 2021-04-06 20:24:44


bfs应该是这个样子的,因为要判断8个方向 ```cpp void bfs(int x,int y){ bool flag1=0,flag2=0; int cnt=a[x][y]; arr.x=x,arr.y=y; q.push(arr); while(q.size()){ node sum=q.front(); q.pop(); for(int i=0;i<8;i++){ int tx=sum.x+kx[i]; int ty=sum.y+ky[i]; if(tx<=0||ty<=0||tx>n||ty>n){ continue; } if(a[tx][ty]==cnt&&!f[tx][ty]){ arr.x=tx,arr.y=ty; f[tx][ty]=1; q.push(arr); } else if(a[tx][ty]>cnt)flag1=1; else if(a[tx][ty]<cnt)flag2=1; } } if(!flag1)ans1++; if(!flag2)ans2++; } ```
by BADFIVE @ 2021-04-06 20:25:40


好像都不是的样子····
by Kiloio @ 2021-04-06 20:26:00


@[子滋蓻啙茡](/user/169555) az,要标记的(
by BADFIVE @ 2021-04-06 20:26:49


我是dfs做的,唉
by Kiloio @ 2021-04-06 20:27:34


@[不会扣字?](/user/307862) 标记了的啊
by Kiloio @ 2021-04-06 20:27:56


@[子滋蓻啙茡](/user/169555) 这,,,再见(
by BADFIVE @ 2021-04-06 20:28:00


| 下一页