結果
問題 | No.1868 Teleporting Cyanmond |
ユーザー |
![]() |
提出日時 | 2022-03-11 21:29:03 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 100 ms / 2,000 ms |
コード長 | 348 bytes |
コンパイル時間 | 288 ms |
コンパイル使用メモリ | 82,048 KB |
実行使用メモリ | 91,776 KB |
最終ジャッジ日時 | 2024-09-16 01:32:34 |
合計ジャッジ時間 | 3,727 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 25 |
ソースコード
from collections import deque n = int(input()) r = list(map(int,input().split())) tansaku = [0] * n dp = [0] * n mada = deque([0]) tmp = 0 while mada: i = mada.popleft() if i < n-1: for j in range(max(tmp, i+1), r[i]): if tansaku[j] == 0: tansaku[j] = 1 mada.append(j) dp[j] = dp[i] + 1 tmp = max(tmp, r[i]) print(dp[n-1])