ENG  RUSTimus Online Judge
Online Judge
Problems
Authors
Online contests
About Online Judge
Frequently asked questions
Site news
Webboard
Links
Problem set
Submit solution
Judge status
Guide
Register
Update your info
Authors ranklist
Current contest
Scheduled contests
Past contests
Rules
back to board

Discussion of Problem 1742. Team building

How to find minimum teams using SCC?
Posted by ajay jadhav 14 May 2020 20:45
I got AC for maximum temas using Kosaraju.
and for minimum I started with nodes with no incoming edge and searched until it hit previously found node (cycle) this is 1 team.
For disconnected cycles, run dfs in similar fashion incrementing teams by 1.