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

18664번 - Minimums on the Edges 스페셜 저지다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
4 초 512 MB167483725.342%

문제

You are given an undirected graph with n vertices and m edges. Each vertex can contain several tokens. Initially, there are no tokens in the vertices, but you have s tokens which you can distribute between them.

Let the capacity of each edge be the minimal number of tokens in its endpoints. You goal is to maximize the sum of capacities of all edges.

입력

The first line contains three integers n, m and s: the number of vertices, the number of edges and the number of tokens to distribute (1 ≤ n ≤ 18, 0 ≤ m ≤ 100 000, 0 ≤ s ≤ 100).

The next m lines describe the edges. The i-th of them describes i-th edge and contains two integers u and v: the indices of vertices it connects (1 ≤ u, v ≤ n).

It is guaranteed that there are no self-loops in the graph. However, there can be multiple edges between the same pair of vertices.

출력

Print n numbers a1, a2, . . . , an (0 ≤ ai ≤ s), where ai is the number of tokens you put on the i-th vertex. The sum of printed integers must be equal to s. The sum of capacities of all edges must be the maximum possible.

If there are multiple optimal answers, you can print any one of them.

제한

예제 입력 1

4 4 6
1 2
2 3
3 1
1 4

예제 출력 1

2 2 2 0

예제 입력 2

3 7 7
1 2
1 2
1 2
1 3
1 3
2 3
2 3

예제 출력 2

3 2 2

힌트

In the first sample, the sum of capacities is equal to min(2, 2) + min(2, 2) + min(2, 2) + min(2, 0) = 2 +たす 2 +たす 2 +たす 0 = 6.

In the second sample, the sum of capacities is equal to min(3, 2) + min(3, 2) + min(3, 2) + min(3, 2) + min(3, 2) + min(2, 2) + min(2, 2) = 2 +たす 2 +たす 2 +たす 2 +たす 2 +たす 2 +たす 2 = 14.

출처

Camp > Petrozavodsk Programming Camp > Summer 2019 > Day 9: MEX Foundation Contest E번

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

출처

대학교 대회

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

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