結果
| 問題 | No.1868 Teleporting Cyanmond |
| コンテスト | |
| ユーザー |
AEn
|
| 提出日時 | 2022-05-12 13:12:36 |
| 言語 | PyPy3 (7.3.17) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 358 bytes |
| 記録 | |
| コンパイル時間 | 113 ms |
| コンパイル使用メモリ | 85,520 KB |
| 実行使用メモリ | 190,208 KB |
| 最終ジャッジ日時 | 2026-04-02 21:31:49 |
| 合計ジャッジ時間 | 9,929 ms |
|
ジャッジサーバーID (参考情報) |
judge3_0 / judge1_1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| 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