https://www.spoj.com/problems/PPATH/


why does this code fail to run for this problem…plz correct it
and provide the corrected code…
i have used bfs to solve this problem after adding to graph all such pairs of primes of 4 digits that differ only by 1 digit…and then bfs

@S19LPPP0202

	if(isvisited[t]==0)
        		{   //cout<<t<<" ";
        			isvisited[t]=1;
        			dist[t]=dist[cur]+1;
        			q.push(t);
        		}
                else
                   dist[t]=min(dist[t],dist[cur]+1);

Just make this small change
If this resolves your doubt mark it as resolved.

yeah thanks plz help me to solve this problem …

@S19LPPP0202 Hey it would be better if you raise this as new doubt and resolve this one.

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.

plz reply to other doubts of mine as well.they are unanswered from many days


this is one of them i have asked it seperately only…click on it and plz reply