QOJ.ac

QOJ

時間限制: 7 s 記憶體限制: 512 MB 總分: 100

#11086. 果汁枢纽

统计

你受雇于一家老旧的水果加工厂,负责升级其橙汁运输系统。该系统由管道和节点组成。所有管道都是双向的,且流量上限均为每秒 1 升。管道在节点处汇合,每个节点最多连接 3 条管道。节点本身的流量上限不受限制。节点用 1 到 $n$ 的整数表示。

在提出升级方案之前,你需要分析现有的系统。对于两个不同的节点 $s$ 和 $t$,$s$-$t$ 流量定义为:若源点设在节点 $s$、汇点设在节点 $t$ 时,系统所能传输的最大橙汁量(单位为升/秒)。例如,在下方第一个样例输入所描述的系统中,1-6 流量为 3,而 1-2 流量为 2。

请计算所有满足 $a < b$ 的节点对 $(a, b)$ 的 $a$-$b$ 流量之和。

输入格式

第一行包含两个整数 $n$ 和 $m$ ($2 \le n \le 3\,000$, $0 \le m \le 4\,500$),分别表示节点的数量和管道的数量。接下来的 $m$ 行,每行包含两个不同的整数 $a$ 和 $b$ ($1 \le a, b \le n$),描述了一条连接节点 $a$ 和 $b$ 的管道。

每个节点最多连接 3 条其他管道。任意两个节点之间最多只有一条管道相连。

输出格式

输出一个整数,即所有满足 $a < b$ 的节点对 $(a, b)$ 的 $a$-$b$ 流量之和。

样例

样例输入 1

6 8
1 3
2 3
4 1
5 6
2 6
5 1
6 4
5 3

样例输出 1

36

样例输入 2

4 2
1 2
3 4

样例输出 2

2

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.