結果
問題 |
No.914 Omiyage
|
ユーザー |
|
提出日時 | 2020-12-13 01:35:34 |
言語 | PyPy3 (7.3.15) |
結果 |
WA
|
実行時間 | - |
コード長 | 422 bytes |
コンパイル時間 | 230 ms |
コンパイル使用メモリ | 81,920 KB |
実行使用メモリ | 72,320 KB |
最終ジャッジ日時 | 2024-09-19 22:40:48 |
合計ジャッジ時間 | 2,062 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 13 WA * 5 |
ソースコード
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)