結果

問題 No.1868 Teleporting Cyanmond
ユーザー AEnAEn
提出日時 2022-05-12 13:26:09
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 124 ms / 2,000 ms
コード長 394 bytes
コンパイル時間 717 ms
コンパイル使用メモリ 87,312 KB
実行使用メモリ 93,236 KB
最終ジャッジ日時 2023-09-27 12:42:25
合計ジャッジ時間 4,971 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 77 ms
71,712 KB
testcase_01 AC 96 ms
71,508 KB
testcase_02 AC 76 ms
71,488 KB
testcase_03 AC 104 ms
91,116 KB
testcase_04 AC 99 ms
86,496 KB
testcase_05 AC 89 ms
77,584 KB
testcase_06 AC 90 ms
77,776 KB
testcase_07 AC 94 ms
82,540 KB
testcase_08 AC 92 ms
79,976 KB
testcase_09 AC 96 ms
81,820 KB
testcase_10 AC 103 ms
89,316 KB
testcase_11 AC 86 ms
77,708 KB
testcase_12 AC 92 ms
79,096 KB
testcase_13 AC 99 ms
82,716 KB
testcase_14 AC 112 ms
91,236 KB
testcase_15 AC 99 ms
86,284 KB
testcase_16 AC 93 ms
77,724 KB
testcase_17 AC 98 ms
78,688 KB
testcase_18 AC 115 ms
93,136 KB
testcase_19 AC 118 ms
93,064 KB
testcase_20 AC 118 ms
93,084 KB
testcase_21 AC 120 ms
92,856 KB
testcase_22 AC 117 ms
92,972 KB
testcase_23 AC 118 ms
93,068 KB
testcase_24 AC 117 ms
93,108 KB
testcase_25 AC 118 ms
93,136 KB
testcase_26 AC 124 ms
93,236 KB
testcase_27 AC 118 ms
93,148 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from collections import deque

N = int(input())
R = list(map(int, input().split()))
seen = [False]*N
dis = [0]*N
posi = 0
d = deque()
d.append(0)
while d:
    v = d.popleft()
    if v == N-1:
        break
    for i in range(max(posi, v+1), R[v]):
        if not seen[i]:
            dis[i] = dis[v]+1
            seen[i] = True
            d.append(i)
    posi = max(posi, R[v])
print(dis[-1])
0