結果

問題 No.1868 Teleporting Cyanmond
ユーザー Raff
提出日時 2022-03-12 12:29:20
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
RE  
実行時間 -
コード長 356 bytes
コンパイル時間 741 ms
コンパイル使用メモリ 64,904 KB
実行使用メモリ 14,016 KB
最終ジャッジ日時 2024-09-16 18:23:13
合計ジャッジ時間 5,261 ms
ジャッジサーバーID
(参考情報)
judge4 / judge6
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample WA * 2 RE * 1
other TLE * 1 -- * 24
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<iostream>
using namespace std;

int main() {
    int n; cin >> n;
    int R[n];
    for(int i=0; i<n;i++)cin >>R[i];
    int p=0;
    int ans = 0;
    
    while (R[p] != n) {
        int to = 0;
        for(int i=0; i<R[p];i++) {
            if (to < R[i]) to = R[i];
        }
        ++ans;
        p = to;
    }
    cout << ans << endl;
    
}
0