結果

問題 No.817 Coin donation
ユーザー H20
提出日時 2021-09-22 11:21:25
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 418 bytes
コンパイル時間 159 ms
コンパイル使用メモリ 82,048 KB
実行使用メモリ 89,088 KB
最終ジャッジ日時 2024-07-04 23:38:09
合計ジャッジ時間 2,972 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 9 WA * 5
権限があれば一括ダウンロードができます

ソースコード

diff #

N,K = map(int,input().split())
AB = []
for i in range(N):
    AB.append(list(map(int,input().split())))

def is_ok(v):
    temp = 0
    for a,b in AB:
        temp+=max(0,min(v,b)-a+1)
    return temp>K


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

print(meguru_bisect(0,10**9+100))
0