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 #222 (Div. 2)
-
Codeforces Round #435 (Div. 2)-B. Mahmoud and Ehab and the bipartiteness
-
Codeforces Round #157 (Div. 1) C. Little Elephant and LCM (数学、dp)
-
Codeforces Round #279 (Div. 2) 解题报告_html/css_WEB-ITnose
-
Codeforces Round #340 (Div. 2)-E-XOR and Favorite Number(莫队)
-
Codeforces Round #482 (Div. 2) D. Kuro and GCD and XOR and SUM(数学+01字典树)(好题)
-
Codeforces Round #553 (Div. 2) B. Dima and a Bad XOR(异或+思维)
-
Codeforces Round #246 (Div. 2) ?B. Football Kit_html/css_WEB-ITnose
-
Codeforces Round #261 (Div. 2)B. Pashmak and Flowers(容易)
-
Educational Codeforces Round 41 (Rated for Div. 2) E. Tufurama(树状数组+偏序)