結果
問題 | No.2157 崖 |
ユーザー | rlangevin |
提出日時 | 2024-01-23 08:55:49 |
言語 | PyPy3 (7.3.15) |
結果 |
WA
|
実行時間 | - |
コード長 | 765 bytes |
コンパイル時間 | 406 ms |
コンパイル使用メモリ | 81,572 KB |
実行使用メモリ | 93,936 KB |
最終ジャッジ日時 | 2024-01-23 08:55:59 |
合計ジャッジ時間 | 9,853 ms |
ジャッジサーバーID (参考情報) |
judge12 / judge14 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 35 ms
53,460 KB |
testcase_01 | AC | 36 ms
53,460 KB |
testcase_02 | AC | 36 ms
53,460 KB |
testcase_03 | AC | 39 ms
53,460 KB |
testcase_04 | AC | 36 ms
53,460 KB |
testcase_05 | AC | 35 ms
53,460 KB |
testcase_06 | AC | 36 ms
53,460 KB |
testcase_07 | AC | 37 ms
53,460 KB |
testcase_08 | WA | - |
testcase_09 | WA | - |
testcase_10 | AC | 36 ms
53,460 KB |
testcase_11 | WA | - |
testcase_12 | WA | - |
testcase_13 | WA | - |
testcase_14 | AC | 490 ms
92,016 KB |
testcase_15 | WA | - |
testcase_16 | WA | - |
testcase_17 | AC | 422 ms
90,352 KB |
testcase_18 | AC | 408 ms
89,840 KB |
testcase_19 | WA | - |
testcase_20 | AC | 534 ms
93,680 KB |
testcase_21 | AC | 547 ms
93,936 KB |
testcase_22 | AC | 392 ms
89,712 KB |
testcase_23 | AC | 35 ms
53,460 KB |
testcase_24 | AC | 59 ms
70,800 KB |
ソースコード
import sys input = sys.stdin.readline N, 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] * M Dpre = D[0] for i in range(1, N): dp = [0] * M Di = D[i] now = 0 for j in range(M): while now < M: if pre[now] and Dpre[now] <= Di[j] <= Dpre[now] + m: dp[j] = 1 break now += 1 dp, pre = pre, dp Dpre, Di = Di, Dpre return sum(pre) yes = 10 ** 9 + 5 no = -1 if not check(yes): print(-1) exit() while yes - no != 1: mid = (yes + no)//2 if check(mid): yes = mid else: no = mid print(yes)