Codeforces Round #743 (Div. 2) ,Problem C

Правка en1, от ayush29azad, 2021-09-19 12:13:53

Yesterday 's contest had some very good problems , unfortunately, it became unrated. Problem Link : https://codeforces.me/contest/1573/problem/C

The problem is based on standard topological sort Prerequisite problem .

If the cycle was found in the graph I printed -1 as the answer. else I found the topical sort of all the chapters , using cycle detection + DFS + queue.

Where I am stuck ?? After finding the topological ordering of chapters (stored in a queue a ->b->c->d.... )how do I count the number of times I will have to read the book/number of passes required ???

Please help !!!

История

 
 
 
 
Правки
 
 
  Rev. Язык Кто Когда Δ Комментарий
en3 Английский ayush29azad 2021-09-19 12:15:20 21
en2 Английский ayush29azad 2021-09-19 12:14:23 2 Tiny change: 'unrated.\nProblem ' -> 'unrated.\n\nProblem '
en1 Английский ayush29azad 2021-09-19 12:13:53 652 Initial revision (published)