- Time limit: 1.00 s
- Memory limit: 512 MB
Your task is to find all critical cities from Syrjälä to Lehmälä.
The first input line has two integers $n$ and $m$: the number of cities and flights. The cities are numbered $1,2,\dots,n$. City $1$ is Syrjälä, and city $n$ is Lehmälä.
Then, there are $m$ lines describing the roads. Each line has two integers $a$ and $b$: there is a flight from city $a$ to city $b$. All flights are one-way flights.
You may assume that there is a route from Syrjälä to Lehmälä.
First print an integer $k$: the number of critical cities. After this, print $k$ integers: the critical cities in increasing order.
- $2 \le n \le 10^5$
- $1 \le m \le 2 \cdot 10^5$
- $1 \le a,b \le n$
1 2 5