CAPCITY - Capital City
There are N cities in Flatland connected with M unidirectional roads. The cities are numbered from 1 to N. The Flat Circle of Flatland (FCF) wants to set up a new capital city for his kingdom. For security reasons, the capital must be reachable from all other cities of Flatland. FCF needs the list of all candidate cities. You are the chief programmer at FACM (Flat Association for Computing Machinery) responsible for providing the list to FCF as soon as possible.
The first line of the input file contains two integers։ 1≤N≤100,000 and 1≤M≤200,000. Each of the following M lines contains two integers 1≤A, B≤N denoting a road from A to B.
The output file contains an integer denoting the number of candidate cities followed by the list of candidate cities in increasing order.
A nice problem
dont forget: you should print candidate cities in increasing order.
Poor test Cases Framed
AC in 2 gos. Saved by .01 seconds from a TLE. #0.99 #LuckFavoursMe
time limit on test 20 bruh bruh:<
AC in 1 go. Took a lot of effort.
I believe that there are duplicated edges in test case 20. AC after handling that case.
Wonderful prob =))) ac in one go
Weak test cases. Getting ac by just printing vertices (sorted order) present in the scc's whose size is greater than 1.