結果
| 問題 |
No.2157 崖
|
| コンテスト | |
| ユーザー |
terasa
|
| 提出日時 | 2022-12-09 23:15:01 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 1,098 bytes |
| コンパイル時間 | 151 ms |
| コンパイル使用メモリ | 81,824 KB |
| 実行使用メモリ | 93,252 KB |
| 最終ジャッジ日時 | 2024-10-14 22:53:28 |
| 合計ジャッジ時間 | 13,929 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 11 TLE * 1 -- * 10 |
ソースコード
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)
terasa