QOJ.ac

QOJ

حد الوقت: 1 s حد الذاكرة: 512 MB مجموع النقاط: 100

#3451. 拦截

الإحصائيات

Fatima 每天乘坐地铁从 KTH 回家。今天 Robert 决定给 Fatima 一个惊喜,他烤了一些饼干,并打算带到一个中途车站送给她。Fatima 并不总是走同一条路线回家,因为她喜欢欣赏斯德哥尔摩不同车站内的艺术品。然而,她总是通过选择最短路径来优化她的行程。你能告诉 Robert 他应该去哪个车站,以便一定能拦截到 Fatima 吗?

照片由 Patrik Neckman 提供

输入格式

第一行包含两个整数 $N$ 和 $M$,$1 \le N, M \le 100\,000$,其中 $N$ 是地铁站的数量,$M$ 是地铁线路的数量。接下来的 $M$ 行,每行包含三个整数 $u, v, w$,$0 \le u, v < N$,$0 < w \le 1\,000\,000\,000$,表示有一条从 $u$ 到 $v$ 的单向线路,通行时间为 $w$ 秒。注意,不同的地铁线路可能服务于同一条路线。最后一行包含两个整数 $s$ 和 $t$,$0 \le s, t < N$,分别表示离 KTH 最近的车站和离家最近的车站。保证从 $s$ 可以到达 $t$。

输出格式

按升序输出所有满足以下条件的车站编号 $u$:从 $s$ 到 $t$ 的所有最短路径都经过 $u$。

样例

输入 1

4 4
0 1 100
0 2 100
1 3 100
2 3 100
0 3

输出 1

0 3

输入 2

7 8
0 1 100
0 2 100
1 3 100
2 3 100
3 4 100
3 5 100
4 6 100
5 6 100
0 6

输出 2

0 3 6

Discussions

About Discussions

The discussion section is only for posting: General Discussions (problem-solving strategies, alternative approaches), and Off-topic conversations.

This is NOT for reporting issues! If you want to report bugs or errors, please use the Issues section below.

Open Discussions 0
No discussions in this category.

Issues

About Issues

If you find any issues with the problem (statement, scoring, time/memory limits, test cases, etc.), you may submit an issue here. A problem moderator will review your issue.

Guidelines:

  1. This is not a place to publish discussions, editorials, or requests to debug your code. Issues are only visible to you and problem moderators.
  2. Do not submit duplicated issues.
  3. Issues must be filed in English or Chinese only.
Active Issues 0
No issues in this category.
Closed/Resolved Issues 0
No issues in this category.