結果
問題 | No.1868 Teleporting Cyanmond |
ユーザー |
|
提出日時 | 2022-03-11 21:58:04 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 82 ms / 2,000 ms |
コード長 | 337 bytes |
コンパイル時間 | 198 ms |
コンパイル使用メモリ | 82,048 KB |
実行使用メモリ | 90,752 KB |
最終ジャッジ日時 | 2024-09-16 02:11:32 |
合計ジャッジ時間 | 3,308 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge6 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 25 |
ソースコード
from collections import deque N = int(input()) R = list(map(int, input().split())) edge = [-1 for _ in range(N)] for i in range(N - 1): for j in range(R[i] - 1, i, -1): if edge[j] == -1: edge[j] = i else: break now = N - 1 cnt = 0 while now != 0: cnt += 1 now = edge[now] print(cnt)