結果
問題 | No.1868 Teleporting Cyanmond |
ユーザー |
![]() |
提出日時 | 2025-03-20 21:09:42 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 60 ms / 2,000 ms |
コード長 | 449 bytes |
コンパイル時間 | 145 ms |
コンパイル使用メモリ | 82,348 KB |
実行使用メモリ | 85,660 KB |
最終ジャッジ日時 | 2025-03-20 21:10:26 |
合計ジャッジ時間 | 2,940 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 25 |
ソースコード
n = int(input())if n == 1:print(0)exit()R = list(map(int, input().split()))jumps = 0current_start = 1current_end = 1while current_end < n:max_i = min(current_end, n-1)if current_start > max_i:print(-1)exit()next_max = 0for i in range(current_start, max_i + 1):next_max = max(next_max, R[i-1])jumps += 1current_start = current_end + 1current_end = next_maxprint(jumps)