結果

問題 No.2157 崖
ユーザー tamlog06tamlog06
提出日時 2022-12-09 22:21:05
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 531 bytes
コンパイル時間 145 ms
コンパイル使用メモリ 82,248 KB
実行使用メモリ 95,632 KB
最終ジャッジ日時 2024-04-22 22:29:34
合計ジャッジ時間 8,664 ms
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 33 ms
53,336 KB
testcase_01 AC 32 ms
52,492 KB
testcase_02 AC 33 ms
52,828 KB
testcase_03 AC 33 ms
53,560 KB
testcase_04 AC 33 ms
52,616 KB
testcase_05 AC 33 ms
52,964 KB
testcase_06 AC 33 ms
52,860 KB
testcase_07 AC 33 ms
52,928 KB
testcase_08 WA -
testcase_09 AC 34 ms
53,976 KB
testcase_10 AC 33 ms
53,140 KB
testcase_11 WA -
testcase_12 AC 33 ms
52,532 KB
testcase_13 WA -
testcase_14 AC 629 ms
93,656 KB
testcase_15 WA -
testcase_16 WA -
testcase_17 AC 542 ms
91,608 KB
testcase_18 AC 537 ms
91,504 KB
testcase_19 WA -
testcase_20 AC 735 ms
94,980 KB
testcase_21 AC 713 ms
95,632 KB
testcase_22 AC 508 ms
90,940 KB
testcase_23 AC 33 ms
53,100 KB
testcase_24 AC 60 ms
72,096 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 = float(-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 not flag:
        ans = min(ans, tmp)

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