Div 2 #743, C — Books, Topo Sort, Need help

Правка en1, от kaiyu, 2021-09-20 12:21:09

1573C - Book

My idea is to use topological sort using BFS and output the max level the BFS reaches.

During BFS, If the indegree of child becomes 0, and the child's node number is greater than the parent node number, i'll push it into the queue without changing the level because this chapter will be understood in the current iteration itself . If the child's node number is lesser, i'll increment the level and push it into the queue because this chapter will require one more iteration to understand.

This solution fails on some case. What's wrong in this solution?

Here is my submission : 129318461

История

 
 
 
 
Правки
 
 
  Rev. Язык Кто Когда Δ Комментарий
en1 Английский kaiyu 2021-09-20 12:21:09 679 Initial revision (published)