title: How to solve Lee's Algorithm in C++?
body: <p>I'm trying to solve a C++ problem using Lee's Algorithm (a maze). I have to find a place where two people meet at the exact same time (the shortest), knowing that R and J represent the places where they start and X are the obstacles. This is how rj.in looks :</p>
  
  <pre><code>5 8
  XXR  XXX
   X  X  X
  J X X  X
        XX
  XXX XXXX
  </code></pre>
  
  <p>And the problem is that when I read it, it always has the same value. What am I doing wrong? This is my code, and this is where the problem appears:</p>
  
  <pre><code>#include &lt;iostream&gt;
  #include &lt;queue&gt;
  #include &lt;cstdio&gt;
  
  using namespace std;
  #define ex -1
  #define red(X) scanf("%d",&amp;X);
  const int MAX=150;
  int ro [MAX][MAX],ju [MAX][MAX];
  inline int inside(int x,int y,int n,int m)
  {
      return x&gt;=1 and x&lt;=n and y&gt;=1 and y&lt;=m;
  }
  queue&lt;pair&lt;int,int&gt; &gt; Qr;
  queue&lt;pair&lt;int,int&gt; &gt; Qj;
  int dx[]={0,0,-1,1};
  int dy[]={1,-1,0,0};
  int main()
  {  freopen("rj.in","r",stdin);
  freopen("rj.out","w",stdout);
  int rx_n,ry_n,jx_n,jy_n,n,m,i,j,t;
  
      red(n);
      red(m);
    for(i=1;i&lt;=n;i++)
          for(j=1;j&lt;=m;j++)
    {
  
  
  red(t); 
  printf("%d ",t);
  
  
  if((char)t=='X') {ro[i][j]=-1; ju[i][j]=-1;  }
        if((char)t=='R') {ro[i][j]=1; Qr.push(make_pair(i,j));}
        if((char)t=='J') {ju[i][j]=1; Qj.push(make_pair(i,j));}
    }
  </code></pre>
  
  <p>I'm using the C functions because they are faster.</p>