結果

問題 No.1868 Teleporting Cyanmond
コンテスト
ユーザー ntuda
提出日時 2022-03-11 23:03:48
言語 PyPy3
(7.3.23 + ACL)
コンパイル:
pypy3 -mpy_compile _filename_
実行:
pypy3 _filename_
結果
AC  
実行時間 85 ms / 2,000 ms
+ 45µs
コード長 270 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 450 ms
コンパイル使用メモリ 96,112 KB
実行使用メモリ 97,280 KB
最終ジャッジ日時 2026-08-28 11:06:38
合計ジャッジ時間 4,476 ms
ジャッジサーバーID
(参考情報)
judge1_0 / judge2_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 25
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

N = int(input())
R = list(map(int,input().split()))
cnt = 1
now = 0
next = 0
for i in range(N-1):
    if i <= now:
        next = max(next,R[i]-1)
    else:
        cnt += 1
        now = next
        next = max(next,R[i]-1)
    if next == N -1:
        break
print(cnt)
0