結果

問題 No.817 Coin donation
ユーザー kohei2019kohei2019
提出日時 2022-04-18 22:45:24
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 210 ms / 2,000 ms
コード長 456 bytes
コンパイル時間 259 ms
コンパイル使用メモリ 86,976 KB
実行使用メモリ 83,124 KB
最終ジャッジ日時 2023-08-28 19:37:09
合計ジャッジ時間 3,227 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 70 ms
71,460 KB
testcase_01 AC 71 ms
71,236 KB
testcase_02 AC 74 ms
75,496 KB
testcase_03 AC 80 ms
75,380 KB
testcase_04 AC 73 ms
75,296 KB
testcase_05 AC 101 ms
77,084 KB
testcase_06 AC 112 ms
77,588 KB
testcase_07 AC 119 ms
77,704 KB
testcase_08 AC 179 ms
81,432 KB
testcase_09 AC 126 ms
78,160 KB
testcase_10 AC 209 ms
83,052 KB
testcase_11 AC 210 ms
82,852 KB
testcase_12 AC 210 ms
83,124 KB
testcase_13 AC 71 ms
71,240 KB
testcase_14 AC 69 ms
71,616 KB
testcase_15 AC 70 ms
71,288 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N,K = map(int,input().split())
lsAB = []
for i in range(N):
    A,B = map(int,input().split())
    lsAB.append((A,B))

def is_ok(arg):
    cnt = 0
    for i in range(N):
        cnt += max(0,min(arg,lsAB[i][1])-lsAB[i][0]+1)
    return cnt >= K
def meguru_bisect(ng, ok):
    while (abs(ok - ng) > 1):
        mid = (ok + ng) // 2
        if is_ok(mid):
            ok = mid
        else:
            ng = mid
    return ok
print(meguru_bisect(0,10**18+1))
0