結果
問題 | No.1868 Teleporting Cyanmond |
ユーザー |
|
提出日時 | 2022-03-11 21:39:27 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 64 ms / 2,000 ms |
コード長 | 306 bytes |
コンパイル時間 | 219 ms |
コンパイル使用メモリ | 82,380 KB |
実行使用メモリ | 83,576 KB |
最終ジャッジ日時 | 2024-09-16 01:49:02 |
合計ジャッジ時間 | 2,684 ms |
ジャッジサーバーID (参考情報) |
judge6 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 25 |
ソースコード
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)