結果

問題 No.1868 Teleporting Cyanmond
ユーザー kept1994kept1994
提出日時 2022-03-19 03:44:56
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 69 ms / 2,000 ms
コード長 559 bytes
コンパイル時間 239 ms
コンパイル使用メモリ 82,340 KB
実行使用メモリ 90,984 KB
最終ジャッジ日時 2024-04-14 16:37:24
合計ジャッジ時間 2,777 ms
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 36 ms
52,420 KB
testcase_01 AC 38 ms
52,260 KB
testcase_02 AC 36 ms
52,204 KB
testcase_03 AC 58 ms
79,780 KB
testcase_04 AC 53 ms
74,616 KB
testcase_05 AC 42 ms
59,944 KB
testcase_06 AC 43 ms
62,432 KB
testcase_07 AC 49 ms
69,360 KB
testcase_08 AC 46 ms
65,848 KB
testcase_09 AC 48 ms
69,612 KB
testcase_10 AC 55 ms
76,796 KB
testcase_11 AC 41 ms
59,480 KB
testcase_12 AC 44 ms
64,712 KB
testcase_13 AC 52 ms
71,332 KB
testcase_14 AC 61 ms
81,924 KB
testcase_15 AC 55 ms
76,276 KB
testcase_16 AC 44 ms
62,972 KB
testcase_17 AC 45 ms
65,356 KB
testcase_18 AC 67 ms
89,184 KB
testcase_19 AC 67 ms
88,048 KB
testcase_20 AC 69 ms
88,792 KB
testcase_21 AC 67 ms
88,676 KB
testcase_22 AC 66 ms
88,164 KB
testcase_23 AC 65 ms
88,976 KB
testcase_24 AC 65 ms
89,468 KB
testcase_25 AC 69 ms
90,984 KB
testcase_26 AC 66 ms
89,184 KB
testcase_27 AC 65 ms
89,328 KB
権限があれば一括ダウンロードができます

ソースコード

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