結果

問題 No.914 Omiyage
ユーザー O2MTO2MT
提出日時 2020-12-13 01:35:34
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 422 bytes
コンパイル時間 240 ms
コンパイル使用メモリ 81,708 KB
実行使用メモリ 73,268 KB
最終ジャッジ日時 2023-10-20 02:54:31
合計ジャッジ時間 2,017 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 AC 39 ms
53,504 KB
testcase_02 AC 57 ms
64,448 KB
testcase_03 AC 40 ms
53,504 KB
testcase_04 AC 60 ms
66,524 KB
testcase_05 AC 38 ms
53,504 KB
testcase_06 AC 38 ms
53,504 KB
testcase_07 AC 40 ms
53,504 KB
testcase_08 AC 37 ms
53,504 KB
testcase_09 WA -
testcase_10 AC 38 ms
53,504 KB
testcase_11 AC 38 ms
53,504 KB
testcase_12 AC 42 ms
53,504 KB
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 AC 38 ms
53,504 KB
testcase_17 AC 37 ms
53,504 KB
testcase_18 AC 38 ms
53,504 KB
testcase_19 AC 37 ms
53,504 KB
testcase_20 AC 36 ms
53,504 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from heapq import *
N,M,K = map(int,input().split())
A = []
for _ in range(N):
    a = list(map(int,input().split()))
    a.sort(reverse=True)
    A.append(a)

ans = -1

hq = [(-a,1) for a in A[0]]

while hq:
    i,j = heappop(hq)
    if j == N:
        ans = -i
        break
    for a in A[j]:
        if -(i-a) > K:
            continue
        heappush(hq,(i-a,j+1))
if ans == -1:
    print(ans)
else:
    print(K-ans)
0