結果

問題 No.914 Omiyage
ユーザー hase_0o0hase_0o0
提出日時 2019-10-26 00:13:14
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 43 ms / 2,000 ms
コード長 453 bytes
コンパイル時間 1,057 ms
コンパイル使用メモリ 81,564 KB
実行使用メモリ 61,692 KB
最終ジャッジ日時 2023-10-24 21:16:58
合計ジャッジ時間 1,968 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 43 ms
61,688 KB
testcase_01 AC 42 ms
61,688 KB
testcase_02 AC 41 ms
59,636 KB
testcase_03 AC 41 ms
61,688 KB
testcase_04 AC 41 ms
61,692 KB
testcase_05 AC 38 ms
53,408 KB
testcase_06 AC 33 ms
53,408 KB
testcase_07 AC 35 ms
53,408 KB
testcase_08 AC 34 ms
53,408 KB
testcase_09 AC 32 ms
53,408 KB
testcase_10 AC 41 ms
59,632 KB
testcase_11 AC 39 ms
59,484 KB
testcase_12 AC 41 ms
61,680 KB
testcase_13 AC 42 ms
61,688 KB
testcase_14 AC 42 ms
61,688 KB
testcase_15 AC 40 ms
59,500 KB
testcase_16 AC 38 ms
59,416 KB
testcase_17 AC 41 ms
61,688 KB
testcase_18 AC 33 ms
53,408 KB
testcase_19 AC 33 ms
53,408 KB
testcase_20 AC 33 ms
53,408 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n,m,k=map(int,input().split())
a=[list(map(int,input().split())) for _ in range(n)]

dp=[[0]*(k+1) for _ in range(n)]

for i in range(m):
    if a[0][i]>k:
        continue
    dp[0][a[0][i]]=1

for i in range(1,n):
    for j in range(m):
        for l in range(k+1):
            if l+a[i][j]>k:
                continue
            if dp[i-1][l]:
                dp[i][l+a[i][j]]=1

x=k+1
for i in range(k+1):
    if dp[n-1][i]:
        x=i
print(k-x)
0