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

33638번 - Birthday Candles 다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
1 초 2048 MB42351990.476%

문제

Minka the Martian is celebrating their birthday with many friends. Similar to Earth birthdays, the occasion is commemorated by blowing candles out on a cake. However, on Mars the candles are placed on the cake differently: each of the $N$ guests attending the party will place $H$ candles on the cake representing the number of hours the Martian has been alive. So the cake will have exactly $N \cdot H$ candles in total. Even more surprising is that each guest hand-crafted the $H$ candles that they placed on the cake, so the candles are not necessarily identical.

Minka is not feeling particularly well today and fears they won’t be able to blow out all candles. Each candle takes a certain effort to blow out, the effort is given as a positive integer. Minka has a capacity $C$ to blow out candles, which may not be enough to blow out all candles.

There is one further complication. Minka wants does not want any guest to feel neglected. When they finish blowing out candles, the number of remaining candles between any two guests should differ by at most one. That is, if for each guest $i$ we let $r_i$ denote the number of their candles remaining after Minka blows some out, then it should be that $|r_i- r_j|≤1$ for any two guests $i$ and $j$.

Determining the maximum number of candles that Minka can blow out such that the total capacity of all extinguished candles is at most $C$ and such that $|r_i-r_j|≤1$ for any two guests $i$ and $j$.

입력

The first line of input contains three integers $N$ (1ドル≤N≤100$), $H$ (1ドル≤H≤1000$), and $C$ (1ドル≤C≤10^9$).

The next $N$ lines describe the candles brought by the guests. The $i$’th such line contains $H$ integers indicating the effort to blow out each of the $H$ candles brought by guest $i$. Each of these values is given as a positive integer at most 10ドル^9$.

출력

Output a single line indicating the maximum number of candles that Minka can blow out subject to the restrictions mentioned above.

제한

예제 입력 1

2 3 6
1 2 1
3 2 1

예제 출력 1

4

예제 입력 2

4 3 30
7 4 5
3 2 4
5 1 2
1 2 6

예제 출력 2

10

예제 입력 3

2 3 3
1 1 1
4 5 7

예제 출력 3

1

힌트

출처

University > University of Alberta Programming Contest > UAPC 2024 > Division 2 F번

  • 문제를 만든 사람: Zachary Friggstad
(追記) (追記ここまで)

출처

대학교 대회

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

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