ABC305 Problem E: Why is this code giving TLE?

Revision en1, by WayBig, 2023-06-10 22:21:07

In today's ABC305, I used multisource BFS to solve problem E. But it is giving TLE. Can anyone please point out the mistake? Moreover, an almost similar question also happened to appear in Codechef STARTERS 93. And an almost similar code, written by me, got accepted in it.

Problem Link: https://atcoder.jp/contests/abc305/tasks/abc305_e

Solution Link: https://atcoder.jp/contests/abc305/submissions/42175490

Code
Tags atcoder, abc305, tle, codechef, graphs, bfs, multisource bfs

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en1 English WayBig 2023-06-10 22:21:07 1758 Initial revision (published)