結果

問題 No.914 Omiyage
ユーザー c-yan
提出日時 2020-10-21 01:37:28
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
AC  
実行時間 30 ms / 2,000 ms
コード長 334 bytes
コンパイル時間 582 ms
コンパイル使用メモリ 12,416 KB
実行使用メモリ 10,752 KB
最終ジャッジ日時 2024-07-21 08:43:59
合計ジャッジ時間 1,880 ms
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 18
権限があれば一括ダウンロードができます

ソースコード

diff #

from bisect import bisect_left

N, M, K = map(int, input().split())

s = {0}
for _ in range(N):
    A = list(map(int, input().split()))
    ns = set()
    for x in s:
        for a in A:
            if x + a > K:
                continue
            ns.add(x + a)
    s = ns

if len(s) == 0:
    print(-1)
else:
    print(K - max(s))
0