結果

問題 No.1868 Teleporting Cyanmond
コンテスト
ユーザー lllllll88938494
提出日時 2022-06-04 02:32:47
言語 PyPy3
(7.3.23 + ACL)
コンパイル:
pypy3 -mpy_compile _filename_
実行:
pypy3 _filename_
結果
AC  
実行時間 71 ms / 2,000 ms
+ 585µs
コード長 198 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 221 ms
コンパイル使用メモリ 95,824 KB
実行使用メモリ 98,564 KB
最終ジャッジ日時 2026-09-01 09:51:41
合計ジャッジ時間 4,664 ms
ジャッジサーバーID
(参考情報)
judge2_0 / judge1_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 25
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

n=int(input())
ns=list(map(int,input().split()))
m=[0]*(n-1)
ma=0
for i in range(n-1):
    ma=max(ns[i],ma)
    m[i] = ma
    
now=m[0]
cnt=1
while now != n:
    now = m[now-1]
    cnt+=1
print(cnt)
0