|Author:||A. Baranov||Time limit:||1 sec|
|Input file:||input.txt||Memory limit:||256 Mb|
You have a document that needs to be signed by university president. It's hard to get president's time, but luckily you know his current location in the university campus. You also know that he is heading to his office now, so you can try to intercept him on the way and ask for a signature. Even more, everyone at university knows that president always takes fastest path wherever he goes. However, if there are several fastest paths, the president chooses any of them.
You need to write a program that determines whether you can guarantee meeting the president no matter which of the fastest path he picks, if you start moving from your room at the same time as the president.
More formally, university campus map is given as an undirected graph. i-th edge is given by its vertices (ai, bi) and traversal time ti (this is a traversal time for any human, either you or the president). Initially, the president is located at vertex p1 and is taking one of the fastest paths to his office located at vertex f. You are initially located at vertex p2. You can get the signature if you meet the president at vertex v such that:
Input file starts with two integers: n — the number of vertices and m — the number of edges.
Then m edges are given by integers ai, bi, ti. Vertices are numbered starting from 0.
Finally, there are three integers f, p1, and p2.
Output file must contain the number of vertices where it is possible to get the signature, followed by the list of vertex numbers in ascending order.
It is guaranteed that the graph is connected, i.e. it's possible to get from any vertex to any other vertex.
There is no more than one edge between each pair of vertices (ai, bi).
2 ≤ n ≤ 1000, 1 ≤ m ≤ n(n − 1) / 2
0 ≤ ai, bi, p1, p2, f < n
ai ≠ bi, p1 ≠ p2
0 < ti ≤ 1000
|No.||Input file (
||Output file (|