結果
| 問題 | No.3459 Defeat Slimes |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2026-02-27 11:09:02 |
| 言語 | Python3 (3.15.0 + numpy 2.5.4 + scipy 1.18.1 + ACL) |
| 結果 |
WA
不安定
(最新)
AC
(最初)
|
| 実行時間 | - |
| コード長 | 913 bytes |
| 記録 | |
| コンパイル時間 | 414 ms |
| コンパイル使用メモリ | 14,848 KB |
| 実行使用メモリ | 63,736 KB |
| 最終ジャッジ日時 | 2026-10-30 20:59:31 |
| 合計ジャッジ時間 | 38,241 ms |
|
ジャッジサーバーID (参考情報) |
judge3_0 / judge4_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 32 WA * 1 |
ソースコード
from heapq import heappush, heappop
n, y, z = map(int, input().split())
clx = [tuple(map(int, input().split())) for _ in range(n)]
clx.sort(key=lambda x: x[1])
clx.append((1, 10**18+1, 1))
h = []
for i in range(n):
if clx[i][1] <= y:
heappush(h, (-clx[i][2], clx[i][0]))
else:
break
ans = 0
while y < z:
nxtl = clx[i][1]
if h:
x, c = heappop(h)
x = -x
if y + c * x >= z and z <= nxtl + x:
ans += (z - y + x - 1) // x
print(ans)
exit()
if y + c * x < nxtl:
ans += c
y += c * x
else:
ans += (nxtl - y + x - 1) // x
y += ((nxtl - y + x - 1) // x) * x
heappush(h, (-x, c - (nxtl - y + x - 1) // x))
else:
print(-1)
exit()
# print(y, ans,h)
while clx[i][1] <= y:
heappush(h, (-clx[i][2], clx[i][0]))
i += 1