結果
| 問題 |
No.817 Coin donation
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2023-11-17 18:36:50 |
| 言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 516 bytes |
| コンパイル時間 | 292 ms |
| コンパイル使用メモリ | 12,416 KB |
| 実行使用メモリ | 65,500 KB |
| 最終ジャッジ日時 | 2024-09-26 05:30:55 |
| 合計ジャッジ時間 | 5,033 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 9 WA * 5 |
ソースコード
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])