結果

問題 No.817 Coin donation
ユーザー ttr
提出日時 2020-06-21 17:46:56
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
AC  
実行時間 512 ms / 2,000 ms
コード長 369 bytes
コンパイル時間 114 ms
コンパイル使用メモリ 12,672 KB
実行使用メモリ 27,264 KB
最終ジャッジ日時 2024-07-03 18:08:01
合計ジャッジ時間 3,807 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 14
権限があれば一括ダウンロードができます

ソースコード

diff #

N,K = map(int, input().split())

def f(n):
    res = 0
    for t in L:
        if t[0] <= n <= t[1]:
            res += n-t[0]+1
        elif t[1] < n:
            res += t[1]-t[0]+1
    return res

L = [[int(l) for l in input().split()] for _ in range(N)]
l = 1
r = 10**9
while r-l > 1:
    m = (l+r)//2
    if f(m) < K:
        l = m
    else:
        r = m

print(r)
0