hiho week 272 register

Ended

Participants:79

Verdict:Accepted
Score:100 / 100
Submitted:2019-09-15 13:02:03

Lang:G++

Edit
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#include <bits/stdc++.h>
using namespace std;
const int N = 505;
int n,m;
int vis[N][N];
char Map[N][N];
int mx[] = {0,0,1,-1};
int my[] = {1,-1,0,0};
int bfs(int sx,int sy,int ex,int ey)
{
    queue<int>q;
    q.push(sx);q.push(sy);q.push(0);
    while(!q.empty())
    {
        int nx = q.front();q.pop();
        int ny = q.front();q.pop();
        int step = q.front();q.pop();
        if(vis[nx][ny])
            continue;
        //cout << nx <<' '<<ny << ' '<<step<<endl;
        //cout << ex <<' '<<ey<<endl;
        if(nx == ex && ny == ey)
        {
            return step-1;
        }
        vis[nx][ny]=1;
        for(int i = 0; i < 4; i++)
        {
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX