Codeforces Round #286 (Div. 2) D.
Shuseki Kingdom is the world's leading nation for innovation and technology. There are n cities in the kingdom, numbered from 1 to n . Thanks to Mr. Kitayuta's research, it has finally become possible to construct teleportation pipes betwe
Shuseki Kingdom is the world's leading nation for innovation and technology. There are n cities in the kingdom, numbered from 1 to n.
Thanks to Mr. Kitayuta's research, it has finally become possible to construct teleportation pipes between two cities. A teleportation pipe will connect two cities unidirectionally, that is, a teleportation pipe from city x to city y cannot be used to travel from city y to city x. The transportation within each city is extremely developed, therefore if a pipe from city x to city yand a pipe from city y to city z are both constructed, people will be able to travel from city x to city z instantly.
Mr. Kitayuta is also involved in national politics. He considers that the transportation between the m pairs of city (ai,?bi) (1?≤?i?≤?m) is important. He is planning to construct teleportation pipes so that for each important pair (ai,?bi), it will be possible to travel from city ai to city bi by using one or more teleportation pipes (but not necessarily from city bi to city ai). Find the minimum number of teleportation pipes that need to be constructed. So far, no teleportation pipe has been constructed, and there is no other effective transportation between cities.
推荐阅读
-
Codeforces Round #286 (Div. 2) D.
-
Codeforces Round #260 (Div. 2) 题解
-
Codeforces Round #FF (Div. 2)E(线段树成段更新)_html/css_WEB-ITnose
-
codeforces Round #275(div2) D解题报告
-
Codeforces Round #260 (Div. 1)??Civilization_html/css_WEB-ITnose
-
codeforces Round #275(div2) D解题报告_html/css_WEB-ITnose
-
Codeforces Round #254 (Div. 2)D(估计)_html/css_WEB-ITnose
-
BestCoder Round #11 (Div. 2)_html/css_WEB-ITnose
-
Codeforces Round #546 (Div. 2) C. Nastya Is Transposing Matrices(矩阵转置的性质)
-
Codeforces Round #720 (Div. 2)题解