結果

問題 No.817 Coin donation
ユーザー Yukino DX.Yukino DX.
提出日時 2023-11-17 21:25:07
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 1,727 ms / 2,000 ms
コード長 331 bytes
コンパイル時間 151 ms
コンパイル使用メモリ 11,904 KB
実行使用メモリ 23,424 KB
最終ジャッジ日時 2023-11-17 21:25:16
合計ジャッジ時間 8,613 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 28 ms
9,984 KB
testcase_01 AC 28 ms
9,984 KB
testcase_02 AC 29 ms
10,112 KB
testcase_03 AC 31 ms
10,112 KB
testcase_04 AC 28 ms
9,984 KB
testcase_05 AC 75 ms
10,496 KB
testcase_06 AC 249 ms
11,648 KB
testcase_07 AC 307 ms
12,160 KB
testcase_08 AC 1,201 ms
19,200 KB
testcase_09 AC 361 ms
12,544 KB
testcase_10 AC 1,723 ms
23,424 KB
testcase_11 AC 1,727 ms
23,424 KB
testcase_12 AC 1,690 ms
23,424 KB
testcase_13 AC 29 ms
9,984 KB
testcase_14 AC 29 ms
9,984 KB
testcase_15 AC 30 ms
9,984 KB
権限があれば一括ダウンロードができます

ソースコード

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