結果

問題 No.1868 Teleporting Cyanmond
ユーザー minimumminimum
提出日時 2022-03-11 21:58:04
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 141 ms / 2,000 ms
コード長 337 bytes
コンパイル時間 283 ms
コンパイル使用メモリ 86,972 KB
実行使用メモリ 92,340 KB
最終ジャッジ日時 2023-10-14 07:05:37
合計ジャッジ時間 5,198 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 99 ms
71,564 KB
testcase_01 AC 104 ms
71,428 KB
testcase_02 AC 103 ms
71,436 KB
testcase_03 AC 134 ms
90,144 KB
testcase_04 AC 120 ms
85,856 KB
testcase_05 AC 113 ms
77,880 KB
testcase_06 AC 115 ms
77,904 KB
testcase_07 AC 121 ms
82,288 KB
testcase_08 AC 120 ms
79,636 KB
testcase_09 AC 117 ms
81,540 KB
testcase_10 AC 129 ms
88,564 KB
testcase_11 AC 112 ms
77,504 KB
testcase_12 AC 119 ms
78,732 KB
testcase_13 AC 122 ms
82,116 KB
testcase_14 AC 129 ms
90,392 KB
testcase_15 AC 128 ms
85,452 KB
testcase_16 AC 114 ms
77,544 KB
testcase_17 AC 118 ms
78,636 KB
testcase_18 AC 141 ms
92,200 KB
testcase_19 AC 139 ms
92,276 KB
testcase_20 AC 135 ms
92,172 KB
testcase_21 AC 133 ms
92,188 KB
testcase_22 AC 134 ms
92,008 KB
testcase_23 AC 134 ms
92,288 KB
testcase_24 AC 137 ms
92,012 KB
testcase_25 AC 137 ms
92,340 KB
testcase_26 AC 141 ms
92,248 KB
testcase_27 AC 139 ms
92,268 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from collections import deque


N = int(input())
R = list(map(int, input().split()))
edge = [-1 for _ in range(N)]
for i in range(N - 1):
    for j in range(R[i] - 1, i, -1):
        if edge[j] == -1:
            edge[j] = i
        else:
            break

now = N - 1
cnt = 0
while now != 0:
    cnt += 1
    now = edge[now]
print(cnt)
0