結果

問題 No.1868 Teleporting Cyanmond
ユーザー lam6er
提出日時 2025-03-20 21:16:52
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 62 ms / 2,000 ms
コード長 480 bytes
コンパイル時間 156 ms
コンパイル使用メモリ 82,672 KB
実行使用メモリ 83,800 KB
最終ジャッジ日時 2025-03-20 21:17:42
合計ジャッジ時間 2,466 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 25
権限があれば一括ダウンロードができます

ソースコード

diff #

n = int(input())
r = list(map(int, input().split()))

current_end = 1
current_max = 1
steps = 0

for i in range(1, n):  # i是1-based的城镇编号
    if i > current_end:
        break  # 这种情况不会出现,根据题意数据保证可达N
    current_max = max(current_max, r[i-1])  # 输入中的第i-1个元素对应城镇i的R_i
    if i == current_end:
        steps += 1
        if current_max >= n:
            break
        current_end = current_max

print(steps)
0