結果

問題 No.817 Coin donation
ユーザー lllllll88938494lllllll88938494
提出日時 2023-04-28 13:53:04
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 195 ms / 2,000 ms
コード長 388 bytes
コンパイル時間 1,253 ms
コンパイル使用メモリ 82,188 KB
実行使用メモリ 86,448 KB
最終ジャッジ日時 2024-04-28 19:16:31
合計ジャッジ時間 3,181 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 45 ms
52,468 KB
testcase_01 AC 40 ms
52,440 KB
testcase_02 AC 42 ms
58,472 KB
testcase_03 AC 44 ms
59,340 KB
testcase_04 AC 40 ms
53,412 KB
testcase_05 AC 82 ms
76,740 KB
testcase_06 AC 99 ms
77,388 KB
testcase_07 AC 109 ms
77,380 KB
testcase_08 AC 157 ms
82,640 KB
testcase_09 AC 101 ms
77,380 KB
testcase_10 AC 195 ms
86,448 KB
testcase_11 AC 187 ms
86,112 KB
testcase_12 AC 188 ms
86,124 KB
testcase_13 AC 39 ms
53,320 KB
testcase_14 AC 38 ms
52,920 KB
testcase_15 AC 39 ms
52,820 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n,k = map(int,input().split())
x = [list(map(int,input().split())) for i in range(n)]


def  check(a):
    cnt=0
    for i,j in x:
        if i <= a:
            cnt += min(a,j) - i + 1
    if cnt < k:
        return False
    else:
        return True

ng = 0
ok = 10**9

while ok-ng > 1:
    mid = (ok + ng) // 2
    if check(mid):
        ok = mid
    else:
        ng = mid

print(ok)
0