結果

問題 No.1868 Teleporting Cyanmond
ユーザー RaffRaff
提出日時 2022-03-12 12:29:20
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
RE  
実行時間 -
コード長 356 bytes
コンパイル時間 616 ms
コンパイル使用メモリ 64,404 KB
実行使用メモリ 7,968 KB
最終ジャッジ日時 2023-10-15 00:50:20
合計ジャッジ時間 7,774 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 RE -
testcase_01 WA -
testcase_02 WA -
testcase_03 TLE -
testcase_04 -- -
testcase_05 -- -
testcase_06 -- -
testcase_07 -- -
testcase_08 -- -
testcase_09 -- -
testcase_10 -- -
testcase_11 -- -
testcase_12 -- -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
testcase_21 -- -
testcase_22 -- -
testcase_23 -- -
testcase_24 -- -
testcase_25 -- -
testcase_26 -- -
testcase_27 -- -
権限があれば一括ダウンロードができます

ソースコード

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