Comments

"10-20 times slower" is definitely not about C# :)

On SerejaCodeforces Round #167, 14 years ago
+15

It looks like the only difference in kissbuaa's and xiaodao's 2000s is the link in the beginning.. ..which is pointing to the same solution, yep. http://codeforces.me/contest/273/submission/3115085

http://codeforces.me/contest/273/submission/3114783

On Alex_KPRCodeforces Beta Round #80, 15 years ago
+5
One more approach is to use a DFS which counts the number of simple loops in the graph.
Having performed it you just check that only one loop was found and that the graph is connected.

However, m = n check is surely more elegant way :)