結果
| 問題 |
No.817 Coin donation
|
| コンテスト | |
| ユーザー |
AEn
|
| 提出日時 | 2022-05-23 15:51:16 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
AC
|
| 実行時間 | 360 ms / 2,000 ms |
| コード長 | 492 bytes |
| コンパイル時間 | 274 ms |
| コンパイル使用メモリ | 82,176 KB |
| 実行使用メモリ | 98,168 KB |
| 最終ジャッジ日時 | 2024-09-20 13:07:52 |
| 合計ジャッジ時間 | 4,157 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| 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