結果

問題 No.914 Omiyage
ユーザー 💕💖💞💕💖💞
提出日時 2019-12-23 23:00:02
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
(最新)
AC  
(最初)
実行時間 -
コード長 530 bytes
コンパイル時間 113 ms
コンパイル使用メモリ 11,872 KB
実行使用メモリ 10,224 KB
最終ジャッジ日時 2023-10-24 21:20:23
合計ジャッジ時間 1,474 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 33 ms
10,224 KB
testcase_01 AC 30 ms
10,152 KB
testcase_02 AC 29 ms
10,140 KB
testcase_03 AC 34 ms
10,224 KB
testcase_04 WA -
testcase_05 AC 27 ms
10,140 KB
testcase_06 AC 26 ms
10,140 KB
testcase_07 AC 27 ms
10,140 KB
testcase_08 AC 27 ms
10,140 KB
testcase_09 AC 27 ms
10,140 KB
testcase_10 AC 27 ms
10,140 KB
testcase_11 AC 27 ms
10,140 KB
testcase_12 AC 27 ms
10,152 KB
testcase_13 AC 29 ms
10,152 KB
testcase_14 AC 32 ms
10,220 KB
testcase_15 AC 26 ms
10,152 KB
testcase_16 AC 26 ms
10,140 KB
testcase_17 AC 29 ms
10,152 KB
testcase_18 AC 27 ms
10,140 KB
testcase_19 AC 26 ms
10,140 KB
testcase_20 AC 26 ms
10,140 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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

prev_set = set([0])
for n in range(N):
    omiyages = list(map(int,input().split()))
    next_set = set()
    for omiyage in omiyages:
        for prev in prev_set:
            tmp = prev + omiyage
            if tmp == K:
                next_set.add(prev + omiyage)
                break
            elif tmp > K:
                continue
            else:
                next_set.add(prev + omiyage)
    prev_set = next_set

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