Help in Codeforces round 847 . Problem G: tokens in graph
Разница между en1 и en2, 59 символ(ов) изменены
link to submission: https://mirror.codeforces.com/contest/1790/submission/277762835↵
link to problem : https://mirror.codeforces.com/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.

История

 
 
 
 
Правки
 
 
  Rev. Язык Кто Когда Δ Комментарий
en2 Английский sujal22514 2024-08-23 13:21:32 59
en1 Английский sujal22514 2024-08-23 13:16:11 1004 Initial revision (published)