Please help me debugging my BFS code

Revision en1, by vishudon, 2021-07-28 12:57:30

Hello,

I am solving below problem and I have already solved this problem using DFS, but then I tried to solve it using BFS too. I know that below problem can be solved using both BFS and DFS.

I have written a solution using BFS, but my solution is failing at #19 test case (not complete visible test case). I tried hard to debug my code, but can't understand where is the problem in my code. I checked many BFS solutions for this problem, but none of the solution could help me resolving issue in my code. Can someone please help me with this ? Any help will be appreciated. Thanks in advance.

Problem Link: https://codeforces.com/contest/510/problem/B

My Solution Link: https://codeforces.com/contest/510/submission/124016916 ( This solution is failing at #19 test case)

Tags #bfs

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en1 English vishudon 2021-07-28 12:57:30 824 Initial revision (published)