結果

問題 No.1868 Teleporting Cyanmond
ユーザー kept1994
提出日時 2022-03-19 03:44:56
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 73 ms / 2,000 ms
コード長 559 bytes
コンパイル時間 355 ms
コンパイル使用メモリ 82,600 KB
実行使用メモリ 90,496 KB
最終ジャッジ日時 2024-10-03 16:57:27
合計ジャッジ時間 3,004 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 25
権限があれば一括ダウンロードができます

ソースコード

diff #

#!/usr/bin/env python3

def main():
    N = int(input())
    R = list(map(lambda i: int(i) - 1, input().split())) + [N - 1]
    now = 0
    next = 0
    temp = 0
    for i in range(R[0] + 1):
        if R[i] >= temp:
            next = i
            temp = R[i]
    ans = 0
    while now < N - 1:
        checked = now
        now = next
        temp = 0
        for i in range(checked + 1, R[next] + 1):
            if R[i] >= temp:
                next = i
                temp = R[i]
        ans += 1
    print(ans)



if __name__ == '__main__':
    main()
0