結果

問題 No.2157 崖
ユーザー tamlog06tamlog06
提出日時 2022-12-09 22:31:51
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 530 bytes
コンパイル時間 286 ms
コンパイル使用メモリ 82,308 KB
実行使用メモリ 94,848 KB
最終ジャッジ日時 2024-04-22 22:37:13
合計ジャッジ時間 7,474 ms
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 39 ms
52,608 KB
testcase_01 AC 38 ms
52,096 KB
testcase_02 AC 38 ms
51,968 KB
testcase_03 AC 38 ms
51,840 KB
testcase_04 AC 39 ms
52,224 KB
testcase_05 AC 37 ms
52,224 KB
testcase_06 AC 39 ms
52,352 KB
testcase_07 AC 38 ms
52,352 KB
testcase_08 WA -
testcase_09 AC 38 ms
52,480 KB
testcase_10 AC 39 ms
52,480 KB
testcase_11 WA -
testcase_12 AC 39 ms
51,712 KB
testcase_13 WA -
testcase_14 AC 458 ms
93,404 KB
testcase_15 WA -
testcase_16 WA -
testcase_17 AC 404 ms
91,008 KB
testcase_18 AC 396 ms
90,880 KB
testcase_19 WA -
testcase_20 AC 496 ms
94,464 KB
testcase_21 AC 492 ms
94,848 KB
testcase_22 AC 383 ms
90,496 KB
testcase_23 AC 38 ms
52,224 KB
testcase_24 AC 73 ms
71,424 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N, M = map(int, input().split())
D = list(list(map(int, input().split())) for _ in range(N))
for i in range(N):
    D[i].sort()

import bisect
ans = float('inf')

for i in range(M):
    tmp = -1
    flag = False
    A = D[0][i]
    for j in range(1, N):
        idx = bisect.bisect_left(D[j], A)
        if idx == M:
            flag = True
            break

        tmp = max(tmp, D[j][idx]-A)
        A = D[j][idx]

    if flag:
        break
    ans = min(ans, tmp)

if ans == float('inf'):
    print(-1)
else:
    print(ans)
0