結果
| 問題 | No.817 Coin donation |
| コンテスト | |
| ユーザー |
AEn
|
| 提出日時 | 2022-05-23 15:51:16 |
| 言語 | PyPy3 (7.3.23 + ACL) |
| 結果 |
AC
不安定
|
| 実行時間 | 293 ms / 2,000 ms |
| + 519µs | |
| コード長 | 492 bytes |
| 記録 | |
| コンパイル時間 | 230 ms |
| コンパイル使用メモリ | 95,820 KB |
| 実行使用メモリ | 114,556 KB |
| 最終ジャッジ日時 | 2026-08-31 19:40:31 |
| 合計ジャッジ時間 | 4,112 ms |
|
ジャッジサーバーID (参考情報) |
judge1_0 / judge2_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 14 |
ソースコード
N, K = map(int, input().split())
m = []
for i in range(N):
A, B = map(int, input().split())
m.append([1, A])
m.append([-1, B+1])
m.sort(key = lambda x:x[1])
id, cnt, all_num = 0, 0, 0
s = m[0][1]
while True:
w, n = m[id]
if s == n:
cnt += w
id += 1
else:
if all_num + cnt * (n-s) < K:
all_num += cnt*(n-s)
s = n
else:
c, d = divmod((K-all_num), cnt)
print(s+(c-1)+(d>0))
break
AEn