結果

問題 No.817 Coin donation
ユーザー c-yanc-yan
提出日時 2021-01-18 03:14:50
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 512 bytes
コンパイル時間 424 ms
コンパイル使用メモリ 10,936 KB
実行使用メモリ 33,200 KB
最終ジャッジ日時 2023-08-20 09:12:18
合計ジャッジ時間 3,818 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 16 ms
7,776 KB
testcase_01 AC 15 ms
7,752 KB
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 AC 24 ms
8,844 KB
testcase_06 AC 56 ms
11,360 KB
testcase_07 AC 67 ms
11,724 KB
testcase_08 AC 281 ms
23,156 KB
testcase_09 AC 84 ms
12,376 KB
testcase_10 AC 420 ms
33,136 KB
testcase_11 AC 431 ms
33,200 KB
testcase_12 AC 424 ms
33,132 KB
testcase_13 WA -
testcase_14 WA -
testcase_15 AC 16 ms
7,764 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from sys import stdin

readline = stdin.readline

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

d = {}
for _ in range(N):
    A, B = map(int, readline().split())
    d.setdefault(A, 0)
    d[A] += 1
    d.setdefault(B + 1, 0)
    d[B + 1] -= 1

skeys = sorted(d)
for i in range(len(skeys) - 1):
    d[skeys[i + 1]] += d[skeys[i]]

c = 0
for i in range(len(skeys) - 1):
    t = c + d[skeys[i]] * (skeys[i + 1] - skeys[i])
    if t < K:
        c = t
        continue
    print(skeys[i] + (K - c) // d[skeys[i]])
    break
0