I am getting zero in my output .
Que is already attached in my sollution.
Here is the link to my code
Please tell me where i am doing wrong and modify as well.
I am getting zero in my output .
Que is already attached in my sollution.
Here is the link to my code
Please tell me where i am doing wrong and modify as well.
Will dsu work on this que??
Hey @trojan_code, in line 141 and 147 it should be v[x]=y and v[x]=-y respectively, right? I believe you’re trying to map it with the starting and ending point of ladders and snakes.
In line 152, you can change the condition a little bit like
int u = i,v;
if(i+dice<n && v[i+dice]!=0)
v = i+v[i+dice];
else
v = i+dice;
if(v<=n)
gr[u].pb(v)
Other than this, the bfs part looks good to me.
Hope this helps
Yes, I am trying to map it with starting and ending point of ladder and snakes
sir, I am getting correct answer in sample test cases but getting wrong ans when i submit this . I have modified my code a little.