結果

問題 No.1868 Teleporting Cyanmond
ユーザー ikomaikoma
提出日時 2022-03-11 21:59:09
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 268 ms / 2,000 ms
コード長 300 bytes
コンパイル時間 265 ms
コンパイル使用メモリ 87,144 KB
実行使用メモリ 91,856 KB
最終ジャッジ日時 2023-10-14 07:07:49
合計ジャッジ時間 6,899 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 77 ms
71,404 KB
testcase_01 AC 77 ms
71,384 KB
testcase_02 AC 76 ms
71,528 KB
testcase_03 AC 235 ms
89,808 KB
testcase_04 AC 191 ms
85,668 KB
testcase_05 AC 127 ms
78,196 KB
testcase_06 AC 162 ms
78,684 KB
testcase_07 AC 177 ms
82,784 KB
testcase_08 AC 170 ms
80,084 KB
testcase_09 AC 184 ms
81,888 KB
testcase_10 AC 229 ms
88,392 KB
testcase_11 AC 106 ms
78,108 KB
testcase_12 AC 161 ms
79,612 KB
testcase_13 AC 199 ms
82,860 KB
testcase_14 AC 230 ms
89,420 KB
testcase_15 AC 235 ms
84,852 KB
testcase_16 AC 185 ms
79,556 KB
testcase_17 AC 194 ms
79,832 KB
testcase_18 AC 230 ms
91,112 KB
testcase_19 AC 260 ms
91,384 KB
testcase_20 AC 256 ms
91,276 KB
testcase_21 AC 268 ms
91,652 KB
testcase_22 AC 261 ms
91,416 KB
testcase_23 AC 197 ms
91,752 KB
testcase_24 AC 172 ms
91,760 KB
testcase_25 AC 184 ms
91,856 KB
testcase_26 AC 173 ms
91,760 KB
testcase_27 AC 192 ms
91,392 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from heapq import *
N=int(input())
R=list(map(int,input().split()))

dist = [N]*N
dist[0] = 0
que = [(0,0)]

for i in range(N):
    d,rr = que[0]
    while i>rr:
        heappop(que)
        d,rr = que[0]
    dist[i] = d
    if i+1<N:
        r = R[i]
        heappush(que, (d+1,r-1))
print(dist[-1])
0