結果

問題 No.2157 崖
ユーザー terasaterasa
提出日時 2022-12-09 23:15:01
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 1,098 bytes
コンパイル時間 211 ms
コンパイル使用メモリ 82,408 KB
実行使用メモリ 93,236 KB
最終ジャッジ日時 2024-04-22 23:03:29
合計ジャッジ時間 14,057 ms
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 63 ms
68,188 KB
testcase_01 AC 64 ms
67,956 KB
testcase_02 AC 66 ms
68,312 KB
testcase_03 AC 64 ms
68,512 KB
testcase_04 AC 66 ms
68,920 KB
testcase_05 AC 71 ms
70,908 KB
testcase_06 AC 64 ms
68,384 KB
testcase_07 AC 73 ms
72,196 KB
testcase_08 AC 67 ms
70,692 KB
testcase_09 AC 70 ms
71,528 KB
testcase_10 AC 66 ms
68,960 KB
testcase_11 AC 74 ms
72,056 KB
testcase_12 AC 66 ms
69,336 KB
testcase_13 AC 3,855 ms
93,236 KB
testcase_14 TLE -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
testcase_21 -- -
testcase_22 -- -
testcase_23 -- -
testcase_24 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

from typing import List, Tuple, Callable, TypeVar, Optional
import sys
import itertools
import heapq
import bisect
import math
from collections import deque, defaultdict
from functools import lru_cache, cmp_to_key

input = sys.stdin.readline

if __file__ != 'prog.py':
    sys.setrecursionlimit(10 ** 6)


def readints(): return map(int, input().split())
def readlist(): return list(readints())
def readstr(): return input()[:-1]


N, M = readints()
D = [readlist() for _ in range(N)]
for i in range(N):
    D[i].sort()


def judge(A, i, k):
    NA = []
    for d in D[i]:
        l = -1
        r = len(A)
        while r - l > 1:
            c = (l + r) >> 1
            if A[c] <= d:
                l = c
            else:
                r = c
        if l < 0:
            continue
        if d - A[l] <= k:
            NA.append(d)
    return NA


l = -1
r = 10 ** 9 + 10
while r - l > 1:
    c = (l + r) >> 1
    A = D[0]
    for i in range(1, N):
        A = judge(A, i, c)
        if not A:
            l = c
            break
    else:
        r = c
print(r if r < 10 ** 9 + 10 else -1)
0