結果
| 問題 | No.1868 Teleporting Cyanmond |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2022-03-11 21:39:27 |
| 言語 | PyPy3 (8.0.1 + ACL) |
| 結果 |
AC
不安定
|
| 実行時間 | 58 ms / 2,000 ms |
| + 132µs | |
| コード長 | 306 bytes |
| 記録 | |
| コンパイル時間 | 86 ms |
| コンパイル使用メモリ | 64,172 KB |
| 実行使用メモリ | 70,376 KB |
| 最終ジャッジ日時 | 2026-11-30 18:53:58 |
| 合計ジャッジ時間 | 3,371 ms |
|
ジャッジサーバーID (参考情報) |
judge5_0 / judge2_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 26 |
ソースコード
n = int(input())
R = list(map(int, input().split()))
M = [0 for _ in range(n - 1)]
idx = 1
max_n = 1
for i in range(n - 1):
if R[i] > max_n:
idx = i + 1
max_n = R[i]
M[i] = idx
ans = 1
idx = 0
while R[idx] != n:
nidx = M[R[idx] - 1] - 1
idx = nidx
ans += 1
print(ans)