結果
| 問題 | No.1868 Teleporting Cyanmond |
| コンテスト | |
| ユーザー |
AEn
|
| 提出日時 | 2022-05-12 13:12:36 |
| 言語 | PyPy3 (7.3.17) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 358 bytes |
| 記録 | |
| コンパイル時間 | 251 ms |
| コンパイル使用メモリ | 95,844 KB |
| 実行使用メモリ | 99,840 KB |
| 最終ジャッジ日時 | 2026-08-19 15:53:12 |
| 合計ジャッジ時間 | 12,711 ms |
|
ジャッジサーバーID (参考情報) |
judge2_0 / judge1_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 23 TLE * 2 |
ソースコード
from collections import deque
N = int(input())
A = list(map(int, input().split()))
d = deque()
seen = [False]*N
dis = [-1]*N
dis[0] = 0
d.append(0)
while d:
v = d.popleft()
if v == N-1:
break
for i in range(v+1, A[v]):
if not seen[i]:
dis[i] = dis[v]+1
seen[i] = True
d.append(i)
print(dis[-1])
AEn