結果

問題 No.817 Coin donation
ユーザー kohei2019kohei2019
提出日時 2022-04-18 22:41:27
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 455 bytes
コンパイル時間 243 ms
コンパイル使用メモリ 86,820 KB
実行使用メモリ 83,012 KB
最終ジャッジ日時 2023-08-28 19:31:24
合計ジャッジ時間 3,733 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 66 ms
71,160 KB
testcase_01 AC 69 ms
71,388 KB
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 AC 98 ms
76,556 KB
testcase_06 AC 108 ms
77,752 KB
testcase_07 AC 116 ms
77,768 KB
testcase_08 AC 171 ms
81,508 KB
testcase_09 AC 119 ms
78,036 KB
testcase_10 AC 198 ms
82,884 KB
testcase_11 AC 200 ms
82,684 KB
testcase_12 AC 201 ms
83,012 KB
testcase_13 WA -
testcase_14 WA -
testcase_15 AC 67 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