eolymp
bolt
Try our new interface for solving problems
Problems

Transport nodes

Transport nodes

The country N-arity contains $n$ cities. Some of them are connected by roads, the country contains $m$ roads. From some cities goes only one way, but some cities are real transportation hubs --- a lot of roads connects them with other cities. In this problem the city is a \textit{transportation hub}, if it is connected with at least $k$ roads. The description of the road network in N-arity is given. Find all its transportation hubs. \InputFile The first line contains the number $n\:(1 \le n \le 10^4)$ and the number $m\:(1 \le m \le 10^5)$ of roads. Each of the following $m$ lines describe one way and contains two numbers $u$ and $v\:(1 \le u, v \le n, u ≠ v)$ --- the number of cities connected by roads. The last line of input contains an integer $k\:(1 \le k ≤ 10^4)$. Each road is mentioned in the input no more than once. \OutputFile In the first line print the number of transportation hubs. In the second line print the hub numbers in ascending order.
Time limit 1 second
Memory limit 128 MiB
Input example #1
2 1
1 2
1
Output example #1
2
1 2
Input example #2
4 3
1 2
1 3
1 4
3
Output example #2
1
1