結果

問題 No.817 Coin donation
ユーザー 👑 H20H20
提出日時 2021-09-22 11:21:25
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 418 bytes
コンパイル時間 880 ms
コンパイル使用メモリ 86,852 KB
実行使用メモリ 90,300 KB
最終ジャッジ日時 2023-09-18 07:29:32
合計ジャッジ時間 4,452 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 72 ms
71,452 KB
testcase_01 AC 73 ms
71,424 KB
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 AC 112 ms
78,008 KB
testcase_06 AC 130 ms
77,748 KB
testcase_07 AC 135 ms
78,000 KB
testcase_08 AC 216 ms
85,844 KB
testcase_09 AC 136 ms
80,140 KB
testcase_10 AC 259 ms
90,144 KB
testcase_11 AC 240 ms
90,300 KB
testcase_12 AC 256 ms
90,096 KB
testcase_13 WA -
testcase_14 WA -
testcase_15 AC 74 ms
71,312 KB
権限があれば一括ダウンロードができます

ソースコード

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