結果

問題 No.817 Coin donation
ユーザー ttrttr
提出日時 2020-06-21 17:46:56
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 505 ms / 2,000 ms
コード長 369 bytes
コンパイル時間 82 ms
コンパイル使用メモリ 10,960 KB
実行使用メモリ 24,584 KB
最終ジャッジ日時 2023-09-16 18:31:09
合計ジャッジ時間 4,172 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 16 ms
7,844 KB
testcase_01 AC 16 ms
7,812 KB
testcase_02 AC 17 ms
7,808 KB
testcase_03 AC 17 ms
7,800 KB
testcase_04 AC 16 ms
7,840 KB
testcase_05 AC 31 ms
8,624 KB
testcase_06 AC 78 ms
10,276 KB
testcase_07 AC 96 ms
10,920 KB
testcase_08 AC 348 ms
19,536 KB
testcase_09 AC 109 ms
11,428 KB
testcase_10 AC 505 ms
24,548 KB
testcase_11 AC 502 ms
24,544 KB
testcase_12 AC 501 ms
24,584 KB
testcase_13 AC 16 ms
7,852 KB
testcase_14 AC 16 ms
7,844 KB
testcase_15 AC 16 ms
7,852 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N,K = map(int, input().split())

def f(n):
    res = 0
    for t in L:
        if t[0] <= n <= t[1]:
            res += n-t[0]+1
        elif t[1] < n:
            res += t[1]-t[0]+1
    return res

L = [[int(l) for l in input().split()] for _ in range(N)]
l = 1
r = 10**9
while r-l > 1:
    m = (l+r)//2
    if f(m) < K:
        l = m
    else:
        r = m

print(r)
0