link to submission: https://codeforces.me/contest/1790/submission/277762835 link to problem : https://codeforces.me/contest/1790/problem/G
I have been trying to solve it for few hours now. I am getting wrong answer on test-case 5 sub-test : 1634
My approach is similar to what is given in the editorial. My approach is: first I run a breadth first search to find the nearest vertex with token in it and it's path contain only bonus. I take the dis vector to keep it's distance from 1. Then i want to check if there is a edge whose both endpoint is a bonus vertex. If so then is there an vertex with token in the neighbouring vertex of that edge(excluding the already found nearest to 1). If there is then answer is definitely yes.
Otherwise: for each bonus vertex find the number of token near it. and these would be the number of moves I can make to help reach nearest token to token 1.
I am not sure what I am doing wrong . If you have any advice on how solve it please help. Thanks.