結果

問題 No.817 Coin donation
ユーザー Yukino DX.Yukino DX.
提出日時 2023-11-17 18:36:50
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 516 bytes
コンパイル時間 437 ms
コンパイル使用メモリ 11,904 KB
実行使用メモリ 64,856 KB
最終ジャッジ日時 2023-11-17 18:36:56
合計ジャッジ時間 5,618 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 31 ms
9,984 KB
testcase_01 AC 28 ms
9,984 KB
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 AC 43 ms
11,520 KB
testcase_06 AC 100 ms
17,096 KB
testcase_07 AC 121 ms
18,736 KB
testcase_08 AC 511 ms
45,756 KB
testcase_09 AC 138 ms
20,160 KB
testcase_10 AC 738 ms
64,856 KB
testcase_11 AC 711 ms
64,856 KB
testcase_12 AC 751 ms
64,852 KB
testcase_13 WA -
testcase_14 WA -
testcase_15 AC 29 ms
9,984 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from collections import defaultdict as dd

n, k = map(int, input().split())
ab = [tuple(map(int, input().split())) for _ in range(n)]

cnts = dd(int)
for a, b in ab:
    cnts[a] += 1
    cnts[b + 1] -= 1

cnt = 0
acc = 0
cnts = [(key, val) for key, val in sorted(cnts.items())]
m = len(cnts)
for i in range(m - 1):
    acc += cnts[i][1]
    if cnt + acc * (cnts[i + 1][0] - cnts[i][0]) >= k:
        id = (k - cnt) // acc
        print(cnts[i][0] + id)
        exit()

    cnt += acc * (cnts[i + 1][0] - cnts[i][0])
0