結果

問題 No.817 Coin donation
ユーザー tanon710tanon710
提出日時 2019-07-27 00:15:28
言語 Python3
(3.11.6 + numpy 1.26.0 + scipy 1.11.3)
結果
AC  
実行時間 506 ms / 2,000 ms
コード長 351 bytes
コンパイル時間 408 ms
コンパイル使用メモリ 10,772 KB
実行使用メモリ 27,920 KB
最終ジャッジ日時 2023-09-15 05:13:19
合計ジャッジ時間 3,593 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 16 ms
7,860 KB
testcase_01 AC 16 ms
7,768 KB
testcase_02 AC 16 ms
7,784 KB
testcase_03 AC 17 ms
7,768 KB
testcase_04 AC 16 ms
7,784 KB
testcase_05 AC 29 ms
8,400 KB
testcase_06 AC 75 ms
10,684 KB
testcase_07 AC 91 ms
11,300 KB
testcase_08 AC 332 ms
21,600 KB
testcase_09 AC 104 ms
11,900 KB
testcase_10 AC 503 ms
27,920 KB
testcase_11 AC 505 ms
27,828 KB
testcase_12 AC 506 ms
27,848 KB
testcase_13 AC 16 ms
7,812 KB
testcase_14 AC 16 ms
7,928 KB
testcase_15 AC 16 ms
7,788 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

def cond(arr,m):
    ret=0
    for v1,v2 in arr:
        if v1<=m<=v2:
            ret+=(m-v1+1)
        elif v2<m:
            ret+=(v2-v1+1)
    return ret

n,k=map(int,input().split())
arr=[list(map(int,input().split())) for _ in range(n)]
l=0
r=10**9+1
while r-l!=1:
    m=(r+l)//2
    if cond(arr,m)>=k:
        r=m
    else:
        l=m
print(r)
0