QOJ.ac

QOJ

実行時間制限: 5 s メモリ制限: 1024 MB 満点: 100

#3952. 冰淇淋

統計

Better Get Obese (BGO) 冰淇淋工厂正在为节日旺季做准备。在经历了几年平庸的销售业绩后,他们决定只专注于最受欢迎的产品:巧克力和香草口味的冰淇淋。

为了制作出完美的冰淇淋,混合机必须接收到等量的香草冰淇淋和巧克力冰淇淋。

工厂里有两台独立的制冰机,分别生产巧克力冰淇淋和香草冰淇淋,生产出的奶油制品被储存在两个独立的罐子中。从那里,冰淇淋可以通过管道输送到混合机,但管道的尺寸限制了每分钟可以通过的冰淇淋流量。这些管道在焊接点汇合,冰淇淋流可以在焊接点从一根管道流向另一根。如果一个焊接点连接了超过两根管道,冰淇淋流也可以在此处合并或分流。在运输过程中,无需保持口味分离,因为它们最终都会被混合在一起。

给定管道系统的地图,你能确定工厂每分钟能生产多少升冰淇淋吗?

Public Domain, U.S. Air Force photo by Machiko Arita

输入格式

第一行包含两个整数 $n$ ($3 \le n \le 200$) 和 $m$ ($2 \le m \le 1000$),分别表示焊接点的数量和管道的数量。第二行包含三个不同的整数 $f, c$ 和 $v$ ($1 \le f, c, v \le n$),分别表示混合机、巧克力罐和香草罐连接到管道系统的焊接点编号。

接下来有 $m$ 行,第 $i$ 行包含三个非负整数 $u_i, v_i$ 和 $x_i$ ($1 \le u_i, v_i \le n, 1 \le x_i \le 1000$)。这些数据表示在焊接点 $u_i$ 和 $v_i$ 之间有一根管道,其每分钟输送冰淇淋的容量为 $x_i$ 升。注意,同一焊接点之间可能存在多根平行管道。

输出格式

输出一个整数,表示 BGO 工厂每分钟能生产的最大冰淇淋总量(单位:升)。

样例

输入格式 1

3 2
2 1 3
1 2 2
3 2 3

输出格式 1

4

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.