結果

問題 No.2157 崖
ユーザー 👑 H20H20
提出日時 2022-12-09 22:17:56
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 763 bytes
コンパイル時間 320 ms
コンパイル使用メモリ 82,304 KB
実行使用メモリ 147,072 KB
最終ジャッジ日時 2024-04-22 22:25:37
合計ジャッジ時間 9,859 ms
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 32 ms
147,072 KB
testcase_01 AC 43 ms
61,128 KB
testcase_02 AC 33 ms
52,224 KB
testcase_03 AC 34 ms
52,352 KB
testcase_04 AC 33 ms
52,736 KB
testcase_05 AC 45 ms
62,336 KB
testcase_06 AC 33 ms
52,224 KB
testcase_07 AC 50 ms
67,328 KB
testcase_08 AC 37 ms
57,472 KB
testcase_09 AC 45 ms
59,904 KB
testcase_10 AC 34 ms
52,480 KB
testcase_11 AC 45 ms
62,208 KB
testcase_12 AC 36 ms
52,736 KB
testcase_13 TLE -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
testcase_21 -- -
testcase_22 -- -
testcase_23 -- -
testcase_24 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

import bisect
def is_ok(v):
    S = set(range(len(D[0])))
    for i in range(N-1):
        ND = D[i+1]
        NS = set()
        for s in S:
            d = D[i][s]
            l = bisect.bisect_left(ND,d)
            r = bisect.bisect_right(ND,d+v)
            for j in range(l,r):#TLEするようならimos使う
                NS.add(j)
        S = NS
    return S

def meguru_bisect(ng, ok):
    while (abs(ok - ng) > 1):
        mid = (ok + ng) // 2
        if is_ok(mid):
            ok = mid
        else:
            ng = mid
    return ok



N,M = map(int, input().split())
D = []
for i in range(N):
    D.append(sorted(list(set(map(int, input().split())))))
ans = meguru_bisect(-1, 10**9 + 100)
if ans == 10**9+100:
    print(-1)
else:
    print(ans)
0