結果
問題 | No.2157 崖 |
ユーザー |
![]() |
提出日時 | 2024-01-23 08:55:49 |
言語 | PyPy3 (7.3.15) |
結果 |
WA
|
実行時間 | - |
コード長 | 765 bytes |
コンパイル時間 | 284 ms |
コンパイル使用メモリ | 82,336 KB |
実行使用メモリ | 94,792 KB |
最終ジャッジ日時 | 2024-09-28 06:37:34 |
合計ジャッジ時間 | 9,475 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 14 WA * 8 |
ソースコード
import sysinput = sys.stdin.readlineN, M = map(int, input().split())D = []for i in range(N):D.append(list(map(int, input().split())))D[i].sort()def check(m):pre = [1] * MDpre = D[0]for i in range(1, N):dp = [0] * MDi = D[i]now = 0for j in range(M):while now < M:if pre[now] and Dpre[now] <= Di[j] <= Dpre[now] + m:dp[j] = 1breaknow += 1dp, pre = pre, dpDpre, Di = Di, Dprereturn sum(pre)yes = 10 ** 9 + 5no = -1if not check(yes):print(-1)exit()while yes - no != 1:mid = (yes + no)//2if check(mid):yes = midelse:no = midprint(yes)