結果

問題 No.2157 崖
ユーザー 👑 H20H20
提出日時 2022-12-09 22:59:51
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 901 bytes
コンパイル時間 1,578 ms
コンパイル使用メモリ 82,080 KB
実行使用メモリ 194,768 KB
最終ジャッジ日時 2024-04-22 22:54:30
合計ジャッジ時間 14,527 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 39 ms
194,768 KB
testcase_01 AC 41 ms
53,120 KB
testcase_02 AC 40 ms
52,480 KB
testcase_03 AC 44 ms
59,136 KB
testcase_04 AC 41 ms
52,224 KB
testcase_05 AC 50 ms
61,696 KB
testcase_06 AC 39 ms
52,608 KB
testcase_07 AC 61 ms
67,520 KB
testcase_08 AC 44 ms
57,856 KB
testcase_09 AC 53 ms
60,832 KB
testcase_10 AC 39 ms
52,352 KB
testcase_11 AC 56 ms
64,512 KB
testcase_12 AC 40 ms
52,608 KB
testcase_13 AC 4,706 ms
125,312 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 bisect import bisect_left,bisect_right 
from itertools import accumulate
def is_ok(v):
    S = D[0]
    for ND in D[1:]:
        IMOS = [0]*(len(ND)+1)
        for s in S:
            l = bisect_left(ND,s)
            r = bisect_right(ND,s+v)
            IMOS[l]+=1
            IMOS[r]-=1
        NS = []
        L = list(accumulate(IMOS))
        for j,l in enumerate(L):
            if l>0 and j<len(ND):
                NS.append(ND[j])
        S = NS
    return S

N,M = map(int, input().split())
L = [list(map(int, input().split())) for _ in range(N)]
D = []
for l in L:
    D.append(sorted(list(set(l))))
ng = -1
ok = 10**9+100
#早くなることを祈って…
if is_ok(5*10**7):
    ok = 5*10**7
else:
    ng = 5*10**7

while (abs(ok - ng) > 1):
    mid = (ok + ng) // 2
    if is_ok(mid):
        ok = mid
    else:
        ng = mid
if ok == 10**9+100:
    print(-1)
else:
    print(ok)
0