結果
| 問題 | No.914 Omiyage |
| コンテスト | |
| ユーザー |
lam6er
|
| 提出日時 | 2025-03-31 17:33:22 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
AC
|
| 実行時間 | 60 ms / 2,000 ms |
| コード長 | 512 bytes |
| コンパイル時間 | 253 ms |
| コンパイル使用メモリ | 82,444 KB |
| 実行使用メモリ | 61,696 KB |
| 最終ジャッジ日時 | 2025-03-31 17:34:04 |
| 合計ジャッジ時間 | 2,114 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 18 |
ソースコード
n, m, k = map(int, input().split())
countries = [list(map(int, input().split())) for _ in range(n)]
prev = [False] * (k + 1)
prev[0] = True
for country in countries:
current = [False] * (k + 1)
for j in range(k + 1):
if prev[j]:
for a in country:
if j + a <= k:
current[j + a] = True
prev = current
max_total = -1
for j in range(k, -1, -1):
if prev[j]:
max_total = j
break
print(k - max_total if max_total != -1 else -1)
lam6er