Logo
(追記) (追記ここまで)

11622번 - Juice Junctions 다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
7 초 512 MB74413162.000%

문제

You have been hired to upgrade an orange juice transport system in an old fruit processing plant. The system consists of pipes and junctions. All the pipes are bidirectional and have the same flow capacity of 1 liter per second. Pipes may join at junctions and each junction joins at most three pipes. The flow capacity of the junction itself is unlimited. Junctions are denoted with integers from 1 to n.

Before proposing the upgrades, you need to analyze the existing system. For two different junctions s and t, the s-t flow is defined as the maximum amount of juice (in liters per second) that could flow through the system if the source was installed at junction s and the sink at junction t. For example, in the system from the first example input below, the 1-6 flow is 3 while the 1-2 flow is 2.

Find the sum of all a-b flows for every pair of junctions a and b such that a < b.

입력

The first line contains two integers n and m (2 ≤ n ≤ 3 000, 0 ≤ m ≤ 4 500) – the number of junctions and the number of pipes. Each of the following m lines contains two different integers a and b (1 ≤ a, b ≤ n) which describe a pipe connecting junctions a and b.

Every junction will be connected with at most three other junctions. Every pair of junctions will be connected with at most one pipe.

출력

Output a single integer – the sum of all a-b flows for every pair of junctions a and b such that 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

힌트

출처

ICPC > Regionals > Europe > Central European Regional Contest > CERC 2015 J번

(追記) (追記ここまで)

출처

대학교 대회

  • 사업자 등록 번호: 541-88-00682
  • 대표자명: 최백준
  • 주소: 서울시 서초구 서초대로74길 29 서초파라곤 412호
  • 전화번호: 02-521-0487 (이메일로 연락 주세요)
  • 이메일: contacts@startlink.io
  • 통신판매신고번호: 제 2017-서울서초-2193 호

AltStyle によって変換されたページ (->オリジナル) /