#P2863. [USACO06JAN] The Cow Prom S
[USACO06JAN] The Cow Prom S
Description
Given a directed graph with vertices and edges, find the number of strongly connected components that contain more than 1 vertex.
Input Format
The first line contains two integers and .
Lines 2 through , each line contains two integers and , indicating a directed edge from to .
Output Format
Output a single line containing the number of strongly connected components with more than 1 vertex.
5 4
2 4
3 5
1 2
4 1
1
Hint
Constraints
For all test points, it is guaranteed that , , .
Translated by ChatGPT 5
京公网安备 11011102002149号