TPCPPLAR  Popular
English  Vietnamese 
Given a directed graph G , N vertices and M arcs.
A node X called "acessible" to Y if there is a path from X to Y
A node X called "popular" if every node Y in V fulfill one of two conditions :
1. X is acessible to Y
2. Y is acessible to X
The Problem : Given graph G, count the number of popular node.
Input
 The first line contain N and M, the number of nodes and arcs (1 <= N <= 150000; 1 <= M <= 300000)
 M next lines, each line contains x and y, there is a arcs connect from x to y.
Output
 First line print number of popular nodes.
 Second line print populars node in increasing order.
Example
Input:
5 4
1 2
3 2
2 4
4 5
Output:
3
2 4 5
hide comments
vaibhav2303:
20180627 17:00:03
Test Cases are wrong / weak:


Shubham Jadhav:
20150509 23:37:04
getting WA .. ;( any crucial test case? 

Mew.:
20141001 13:43:37
That's valid. 

Jacob Plachta:
20141001 13:43:37
So what if both conditions are true (X is reachable from Y and vice versa)? I assume that's valid? 

Mew.:
20141001 13:43:37
It can be refered that every node can go to X or X can go to 

Jacob Plachta:
20141001 13:43:37
I assume that at least one of the conditions for popularity needs to be satisfied, right (as opposed to exactly one)? 

raj kamal:
20141001 13:43:37
what does a judgement result of "0"mean? and i didn't got any points for it...weird 

Mitch Schwartz:
20141001 13:43:37
The way SPOJ is currently set up, problems with numeric scoring in classical section are counted as if they were challenge problems for the purposes of points/rank. So, scoring should be changed to binary, or problem should be moved to partial section. Last edit: 20140919 18:17:38 

Mew.:
20141001 13:43:37
MASTER JUDGE:


Jacob Plachta:
20141001 13:43:37
That's weird, what does a judgment result of "25" mean? 
Added by:  Mew. 
Date:  20140918 
Time limit:  1s 
Source limit:  50000B 
Memory limit:  1536MB 
Cluster:  Cube (Intel G860) 
Languages:  All except: ASM64 