結果

問題 No.817 Coin donation
ユーザー tktk_snsntktk_snsn
提出日時 2020-12-26 02:50:04
言語 PyPy3
(7.3.13)
結果
AC  
実行時間 154 ms / 2,000 ms
コード長 444 bytes
コンパイル時間 433 ms
コンパイル使用メモリ 81,504 KB
実行使用メモリ 86,272 KB
最終ジャッジ日時 2023-10-24 04:40:12
合計ジャッジ時間 2,404 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 41 ms
53,444 KB
testcase_01 AC 39 ms
53,444 KB
testcase_02 AC 43 ms
59,180 KB
testcase_03 AC 44 ms
59,180 KB
testcase_04 AC 40 ms
53,444 KB
testcase_05 AC 62 ms
68,116 KB
testcase_06 AC 74 ms
76,448 KB
testcase_07 AC 78 ms
76,908 KB
testcase_08 AC 125 ms
83,404 KB
testcase_09 AC 82 ms
77,384 KB
testcase_10 AC 153 ms
86,272 KB
testcase_11 AC 154 ms
86,272 KB
testcase_12 AC 150 ms
86,268 KB
testcase_13 AC 39 ms
53,444 KB
testcase_14 AC 38 ms
53,444 KB
testcase_15 AC 38 ms
53,444 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
input = sys.stdin.buffer.readline
sys.setrecursionlimit(10 ** 7)

N, K = map(int, input().split())
AB = tuple(tuple(map(int, input().split())) for _ in range(N))


def C(x):
    cnt = 0
    for a, b in AB:
        if x < a:
            continue
        b = min(b, x)
        cnt += b - a + 1
    return cnt >= K


l = 0
r = 10 ** 9 + 2
while r - l > 1:
    m = (r + l) // 2
    if C(m):
        r = m
    else:
        l = m
print(r)
0