結果

問題 No.914 Omiyage
ユーザー maspymaspy
提出日時 2020-01-28 23:25:32
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 21 ms / 2,000 ms
コード長 411 bytes
コンパイル時間 118 ms
コンパイル使用メモリ 10,560 KB
実行使用メモリ 8,672 KB
最終ジャッジ日時 2023-10-13 20:58:14
合計ジャッジ時間 2,354 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 21 ms
8,556 KB
testcase_01 AC 20 ms
8,500 KB
testcase_02 AC 20 ms
8,648 KB
testcase_03 AC 20 ms
8,612 KB
testcase_04 AC 20 ms
8,524 KB
testcase_05 AC 20 ms
8,608 KB
testcase_06 AC 20 ms
8,628 KB
testcase_07 AC 20 ms
8,652 KB
testcase_08 AC 20 ms
8,612 KB
testcase_09 AC 20 ms
8,580 KB
testcase_10 AC 20 ms
8,628 KB
testcase_11 AC 20 ms
8,648 KB
testcase_12 AC 20 ms
8,544 KB
testcase_13 AC 21 ms
8,552 KB
testcase_14 AC 20 ms
8,672 KB
testcase_15 AC 20 ms
8,500 KB
testcase_16 AC 20 ms
8,496 KB
testcase_17 AC 20 ms
8,560 KB
testcase_18 AC 20 ms
8,504 KB
testcase_19 AC 19 ms
8,652 KB
testcase_20 AC 20 ms
8,628 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

from functools import reduce

N,M,K = map(int,readline().split())
As = [list(map(int,readline().split())) for _ in range(N)]

dp = 1
for A in As:
    dp = reduce(lambda x,y: x|(dp << y), A, 0)

dp = dp & ((1<<K+1) - 1)
if not dp:
    print(-1)
else:
    n = dp.bit_length() - 1
    print(K - n)
0