結果

問題 No.1868 Teleporting Cyanmond
ユーザー phspls
提出日時 2022-09-25 15:26:31
言語 Rust
(1.83.0 + proconio)
結果
WA  
実行時間 -
コード長 461 bytes
コンパイル時間 14,772 ms
コンパイル使用メモリ 377,784 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2024-12-22 12:58:44
合計ジャッジ時間 16,318 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other WA * 25
権限があれば一括ダウンロードができます

ソースコード

diff #

fn main() {
    let mut n = String::new();
    std::io::stdin().read_line(&mut n).ok();
    let n: usize = n.trim().parse().unwrap();
    let mut r = String::new();
    std::io::stdin().read_line(&mut r).ok();
    let r: Vec<usize> = r.trim().split_whitespace().map(|s| s.parse::<usize>().unwrap()-1).collect();

    let mut cnt = 0usize;
    let mut idx = 0usize;
    while idx != n-1 {
        cnt += 1;
        idx = r[idx];
    }
    println!("{}", cnt);
}
0