P18161 [NWERC 2026] Journeying Contestant Problem
Description
You have arrived in beautiful Karlsruhe for NWERC and you cannot wait to explore the city. Unfortunately, your teammates do not quite share your enthusiasm. They would rather stay at the hotel and get some sleep before NWERC.
After some negotiation, they agree to do one simple sightseeing trip. You will start at one attraction and walk to another one. Your teammates had one more condition. You must take the shortest available route. They will notice even the slightest detour.
But perhaps there is still hope. Can you find a route that *just so happens* to pass by every attraction while still being a shortest route from one attraction to another?
Find all starting attractions from which this devious plan can be executed.
Input Format
The input consists of the following.
- One line with two integers $n$ and $m$ ($2 \leq n, m \leq 2 \cdot 10^5$), the number of attractions and one-way connections.
- $m$ lines, the $i$th of which contains three integers $u$, $v$, and $w$ ($1 \leq u, v \leq n$, $u \neq v$, $1 \leq w \leq 10^9$), describing a one-way connection from attraction $u$ to attraction $v$ taking $w$ minutes.
Between any two attractions, there is at most one direct connection in each direction. Every attraction can be reached from every other attraction using one-way connections.
Output Format
Output the number of starting attractions from which some shortest route to some attraction visits every attraction. Then, output all these starting attractions, in any order.
Explanation/Hint
### Sample 3 Explanation

There are two routes that visit every attraction on a shortest route. The blue route follows $1 \to 2 \to 6 \to 3 \to 4 \to 5$ and takes $48$ minutes, while the orange route follows $5 \to 4 \to 3 \to 1 \to 2 \to 6$ and takes $50$ minutes.