結果

問題 No.1868 Teleporting Cyanmond
ユーザー keisuke6keisuke6
提出日時 2022-07-10 22:04:21
言語 C++23
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 210 ms / 2,000 ms
コード長 348 bytes
コンパイル時間 4,407 ms
コンパイル使用メモリ 265,344 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-09-02 05:56:34
合計ジャッジ時間 7,182 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,380 KB
testcase_01 AC 1 ms
4,380 KB
testcase_02 AC 1 ms
4,380 KB
testcase_03 AC 210 ms
4,376 KB
testcase_04 AC 123 ms
4,376 KB
testcase_05 AC 3 ms
4,376 KB
testcase_06 AC 10 ms
4,376 KB
testcase_07 AC 57 ms
4,380 KB
testcase_08 AC 24 ms
4,376 KB
testcase_09 AC 46 ms
4,376 KB
testcase_10 AC 175 ms
4,376 KB
testcase_11 AC 2 ms
4,376 KB
testcase_12 AC 17 ms
4,376 KB
testcase_13 AC 14 ms
4,376 KB
testcase_14 AC 28 ms
4,380 KB
testcase_15 AC 20 ms
4,380 KB
testcase_16 AC 4 ms
4,380 KB
testcase_17 AC 7 ms
4,376 KB
testcase_18 AC 29 ms
4,376 KB
testcase_19 AC 29 ms
4,380 KB
testcase_20 AC 30 ms
4,376 KB
testcase_21 AC 29 ms
4,376 KB
testcase_22 AC 30 ms
4,376 KB
testcase_23 AC 29 ms
4,380 KB
testcase_24 AC 29 ms
4,380 KB
testcase_25 AC 30 ms
4,380 KB
testcase_26 AC 29 ms
4,376 KB
testcase_27 AC 29 ms
4,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#pragma GCC target("avx2")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
#include <bits/stdc++.h>
using namespace std;

int main(){
  int N;
  cin>>N;
  vector<int> S(N-1),A(N,1e9);
  A[0] = 0;
  for(int i=0;i<N-1;i++){
    cin>>S[i];
    S[i]--;
    for(int j=i+1;j<=S[i];j++) A[j] = min(A[j],A[i]+1);
  }
  cout<<A[N-1]<<endl;
}
0