Codeforces Round 1133 (Div. 1, Div. 2) is coming soon! Register here. ×

javacoder1's blog

By javacoder1, history, 11 years ago, In English

Hey i am getting wrong answer on amazing maze http://www.spoj.com/problems/DCEPC701/

my code http://ideone.com/B62iqc I am unable to find the error.Hope someone help me.

  • Vote: I like it
  • 0
  • Vote: I do not like it

»
11 years ago, hide # |
← Rev. 4  
Vote: I like it +3 Vote: I do not like it

http://ideone.com/yOiFFG

I think, answer shouldn't be 0 there

UPD: changed this:

           if(nm[nx][ny]=='#' && temp.dist+1>=arr[nx][ny])
            pq.push(mp(temp.dist+1,nx,ny));
           if(nm[nx][ny]=='.')
            pq.push(mp(temp.dist+1,nx,ny));

to this:

           if(nm[nx][ny]=='#')
           {
	    if (temp.dist+1>=arr[nx][ny])
            pq.push(mp(temp.dist+1,nx,ny));
            else
            pq.push(mp(arr[nx][ny],nx,ny));
      	   } else

           if(nm[nx][ny]=='.')
            pq.push(mp(temp.dist+1,nx,ny));

and got AC.