結果
| 問題 | No.1868 Teleporting Cyanmond |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2025-06-15 22:21:17 |
| 言語 | PyPy3 (7.3.17) |
| 結果 |
AC
|
| 実行時間 | 187 ms / 2,000 ms |
| + 926µs | |
| コード長 | 527 bytes |
| 記録 | |
| コンパイル時間 | 247 ms |
| コンパイル使用メモリ | 96,624 KB |
| 実行使用メモリ | 99,552 KB |
| 最終ジャッジ日時 | 2026-07-12 06:44:11 |
| 合計ジャッジ時間 | 6,698 ms |
|
ジャッジサーバーID (参考情報) |
judge3_0 / judge1_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 25 |
ソースコード
## https://yukicoder.me/problems/no/1868
import heapq
MAX_INT = 10 ** 18
def main():
N = int(input())
R = list(map(int, input().split()))
dp = [MAX_INT] * N
queue = []
heapq.heappush(queue,(0, 0))
for x in range(N):
while len(queue) > 0 and queue[0][-1] < x:
heapq.heappop(queue)
v = queue[0][0]
dp[x] = v
if x < N - 1:
heapq.heappush(queue, (v + 1, R[x] - 1))
print(dp[-1])
if __name__ == "__main__":
main()