結果

問題 No.2157 崖
ユーザー tassei903tassei903
提出日時 2022-12-09 22:01:23
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 773 bytes
コンパイル時間 279 ms
コンパイル使用メモリ 82,304 KB
実行使用メモリ 95,160 KB
最終ジャッジ日時 2024-04-22 22:08:49
合計ジャッジ時間 8,772 ms
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 34 ms
52,352 KB
testcase_01 AC 32 ms
52,224 KB
testcase_02 AC 35 ms
52,224 KB
testcase_03 AC 32 ms
52,864 KB
testcase_04 AC 32 ms
52,352 KB
testcase_05 AC 33 ms
52,352 KB
testcase_06 AC 32 ms
51,968 KB
testcase_07 AC 35 ms
52,352 KB
testcase_08 WA -
testcase_09 AC 34 ms
52,480 KB
testcase_10 AC 32 ms
52,616 KB
testcase_11 WA -
testcase_12 AC 33 ms
52,224 KB
testcase_13 WA -
testcase_14 AC 657 ms
93,056 KB
testcase_15 WA -
testcase_16 WA -
testcase_17 AC 549 ms
90,240 KB
testcase_18 AC 563 ms
90,240 KB
testcase_19 WA -
testcase_20 AC 804 ms
95,160 KB
testcase_21 AC 718 ms
94,336 KB
testcase_22 AC 523 ms
89,800 KB
testcase_23 AC 34 ms
52,480 KB
testcase_24 AC 65 ms
72,064 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
#input = lambda :sys.stdin.readline()[:-1]
ni = lambda :int(input())
na = lambda :list(map(int,input().split()))
yes = lambda :print("yes");Yes = lambda :print("Yes");YES = lambda : print("YES")
no = lambda :print("no");No = lambda :print("No");NO = lambda : print("NO")
#######################################################################

n, m = na()
d = [sorted(na()) for i in range(n)]
if n == 1:
    print(0)
    exit()
from bisect import bisect_left as bl
ans = float("inf")
for i in range(m):
    x = d[0][i]
    z = 0
    for j in range(1, n):
        y = bl(d[j], x)
        if y == m:
            break
        z = max(z, d[j][y]-x)
        x = d[j][y]
    else:
        ans = min(ans, z)

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