結果

問題 No.914 Omiyage
ユーザー simamumusimamumu
提出日時 2019-10-25 21:25:26
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 51 ms / 2,000 ms
コード長 685 bytes
コンパイル時間 85 ms
コンパイル使用メモリ 11,944 KB
実行使用メモリ 10,752 KB
最終ジャッジ日時 2023-10-24 21:08:34
合計ジャッジ時間 1,817 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 51 ms
10,748 KB
testcase_01 AC 43 ms
10,748 KB
testcase_02 AC 36 ms
10,752 KB
testcase_03 AC 47 ms
10,748 KB
testcase_04 AC 36 ms
10,752 KB
testcase_05 AC 35 ms
10,748 KB
testcase_06 AC 35 ms
10,748 KB
testcase_07 AC 35 ms
10,748 KB
testcase_08 AC 35 ms
10,748 KB
testcase_09 AC 37 ms
10,748 KB
testcase_10 AC 40 ms
10,748 KB
testcase_11 AC 38 ms
10,748 KB
testcase_12 AC 44 ms
10,748 KB
testcase_13 AC 39 ms
10,748 KB
testcase_14 AC 46 ms
10,748 KB
testcase_15 AC 36 ms
10,748 KB
testcase_16 AC 37 ms
10,748 KB
testcase_17 AC 43 ms
10,748 KB
testcase_18 AC 34 ms
10,748 KB
testcase_19 AC 34 ms
10,748 KB
testcase_20 AC 34 ms
10,748 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from collections import defaultdict,deque
import sys,heapq,bisect,math,itertools,string,queue,copy,time
sys.setrecursionlimit(10**8)
INF = float('inf')
mod = 10**9+7
eps = 10**-7
def inp(): return int(sys.stdin.readline())
def inpl(): return list(map(int, sys.stdin.readline().split()))
def inpl_str(): return list(sys.stdin.readline().split())

N,M,K = inpl()
dp = [[False]*(K+1) for _ in range(N+1)]
dp[0][K] = True

for i in range(1,N+1):
    AA = inpl()
    for k in range(K+1):
        flag = False
        for A in AA:
            if k+A <= K and dp[i-1][k+A]:
                dp[i][k] = True


for i,f in enumerate(dp[-1]):
    if f:
        print(i)
        exit()

print(-1)
0