結果

問題 No.914 Omiyage
ユーザー stngstng
提出日時 2022-08-14 12:04:37
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 54 ms / 2,000 ms
コード長 456 bytes
コンパイル時間 514 ms
コンパイル使用メモリ 81,700 KB
実行使用メモリ 62,120 KB
最終ジャッジ日時 2024-04-08 11:17:50
合計ジャッジ時間 2,523 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 54 ms
62,120 KB
testcase_01 AC 50 ms
62,120 KB
testcase_02 AC 45 ms
59,852 KB
testcase_03 AC 49 ms
62,120 KB
testcase_04 AC 44 ms
59,724 KB
testcase_05 AC 39 ms
53,460 KB
testcase_06 AC 40 ms
53,460 KB
testcase_07 AC 38 ms
53,460 KB
testcase_08 AC 43 ms
59,756 KB
testcase_09 AC 37 ms
53,460 KB
testcase_10 AC 47 ms
62,116 KB
testcase_11 AC 48 ms
62,116 KB
testcase_12 AC 50 ms
62,120 KB
testcase_13 AC 48 ms
62,116 KB
testcase_14 AC 49 ms
62,120 KB
testcase_15 AC 47 ms
62,112 KB
testcase_16 AC 49 ms
62,116 KB
testcase_17 AC 50 ms
62,120 KB
testcase_18 AC 40 ms
53,460 KB
testcase_19 AC 38 ms
53,460 KB
testcase_20 AC 38 ms
53,460 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n,m,K = map(int,input().split())
a = [[int(i) for i in input().split()] for j in range(n)]

dp = [0]*(K+1)
dp[0] = 1

for i in range(n):
    dpn = [0]*(K+1)
    for j in range(K+1):
        for k in range(m):
            val = j+a[i][k]
            #print(val)
            if val <= K:
                dpn[val] += dp[j]
                #print(val,dp[j],dpn)
    dp = dpn[:]

ans = -1

for i in range(1,K+1):
    if dp[i] >= 1:
        ans = K-i
print(ans)
0