結果

問題 No.817 Coin donation
ユーザー dice4084dice4084
提出日時 2023-01-04 19:48:54
言語 PyPy3
(7.3.13)
結果
AC  
実行時間 219 ms / 2,000 ms
コード長 389 bytes
コンパイル時間 334 ms
コンパイル使用メモリ 87,056 KB
実行使用メモリ 85,776 KB
最終ジャッジ日時 2023-08-18 16:55:21
合計ジャッジ時間 4,368 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 86 ms
71,264 KB
testcase_01 AC 93 ms
71,236 KB
testcase_02 AC 89 ms
75,468 KB
testcase_03 AC 93 ms
75,580 KB
testcase_04 AC 87 ms
71,216 KB
testcase_05 AC 111 ms
76,544 KB
testcase_06 AC 122 ms
78,344 KB
testcase_07 AC 126 ms
78,304 KB
testcase_08 AC 181 ms
82,132 KB
testcase_09 AC 130 ms
78,420 KB
testcase_10 AC 219 ms
85,740 KB
testcase_11 AC 218 ms
85,664 KB
testcase_12 AC 213 ms
85,776 KB
testcase_13 AC 84 ms
71,504 KB
testcase_14 AC 86 ms
71,332 KB
testcase_15 AC 70 ms
71,368 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys

input = sys.stdin.readline

n, k = map(int, input().split())
operation = [tuple(map(int, input().split())) for _ in range(n)]

ok = 10**9
ng = 0
for _ in range(30):
    mid = (ok + ng) // 2
    tmp = 0
    for a, b in operation:
        if mid < a:
            continue
        tmp += min(b, mid) - a + 1
    if tmp >= k:
        ok = mid
    else:
        ng = mid

print(ok)
0