CCCPaste

Untitled

#include 
#include 

using namespace std;

struct node
{
    int i;
    int j;
    int dis;

    node(){}
    node(int _i,int _j, int _dis)
    {
        i=_i;
        j=_j;
        dis=_dis;
    }

    bool operator <(const node &tmp) const
    {
        return dis< tmp.dis;
    }
};
char mat[1005][1005];
bool vis[1005][1005];
int m[1005][1005];

int main()
{
    int a,b;
    cin>>a>>b;
    
    int r2=0,c2=0;
    int r=0,c=0;
    queueq;
    for(int i=0;i>mat[i][j];
            vis[i][j]=false;
            if(mat[i][j]=='G')
            {
                q.push(i);
                q.push(j);
                q.push(0);
                vis[i][j]=true;
            }
            if(mat[i][j]=='R')
            {
                r=i;
                c=j;
            }
            if(mat[i][j]=='Z')
            {
                r2=i;
                c2=j;
            }
        }
    }
    for(int i=0;i=0 && vis[ci-1][cj]==false && mat[ci-1][cj]=='.')
        {
            q.push(ci-1);
            q.push(cj);
            q.push(k+1);
            vis[ci-1][cj]=true;
        }
        if(cj+1=0 && vis[ci][cj-1]==false && mat[ci][cj-1]=='.')
        {
            q.push(ci);
            q.push(cj-1);
            q.push(k+1);
            vis[ci][cj-1]=true;
        }
    }
   
    priority_queueQ;
    Q.push(node(r,c,m[r][c]));
    for(int i = 0; i < a; i++) {
        for(int j = 0; j < b; j++) {
            vis[i][j] = false;
        }
    }
    while(!Q.empty())
    {
        node broj=Q.top();
        Q.pop();
        if(broj.i==r2 && broj.j==c2)
        {
            cout<=0 && vis[broj.i-1][broj.j]==false && mat[broj.i-1][broj.j]=='.')
        {
            Q.push(node(broj.i-1,broj.j,min(broj.dis, m[broj.i-1][broj.j])));            vis[broj.i - 1][broj.j] = true;

        }
        if(broj.j+1=0 && vis[broj.i][broj.j-1]==false && mat[broj.i][broj.j-1]=='.')
        {
            Q.push(node(broj.i,broj.j-1,min(broj.dis, m[broj.i][broj.j-1])));
            vis[broj.i][broj.j - 1] = true;

        }
    }
    return 0;
}

/*
4R2343234
321232123
21G121G12
121232123
G12212234
1221G1234
233**2345
345Z43456
*/