E. Reachability from the Capital
time limit per test
2 seconds
memory limit per test
256 megabytes
input
standard input
output
standard output
There are nn cities and mm roads in Berland. Each road connects a pair of cities. The roads in Berland are one-way.
What is the minimum number of new roads that need to be built to make all the cities reachable from the capital?
New roads will also be one-way.
Input
The first line of input consists of three integers nn, mm and ss (1≤n≤5000,0≤m≤5000,1≤s≤

最低0.47元/天 解锁文章
634

被折叠的 条评论
为什么被折叠?



