結果

問題 No.817 Coin donation
ユーザー Yukino DX.
提出日時 2023-11-17 21:25:07
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
TLE  
(最新)
AC  
(最初)
実行時間 -
コード長 331 bytes
コンパイル時間 311 ms
コンパイル使用メモリ 12,416 KB
実行使用メモリ 24,064 KB
最終ジャッジ日時 2024-09-26 05:32:50
合計ジャッジ時間 10,450 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 11 TLE * 3
権限があれば一括ダウンロードができます

ソースコード

diff #

n, k = map(int, input().split())
ab = [tuple(map(int, input().split())) for _ in range(n)]


def is_ok(x):
    cnt = 0
    for a, b in ab:
        cnt += max(0, min(x, b) - a + 1)

    return k <= cnt


ok, ng = 10**9, 0
while ok - ng > 1:
    m = (ok + ng) // 2
    if is_ok(m):
        ok = m
    else:
        ng = m

print(ok)
0