結果

問題 No.627 ランダムウォークの軌跡
コンテスト
ユーザー elphe
提出日時 2026-02-07 13:43:04
言語 Rust
(1.93.0 + proconio + num + itertools)
結果
AC  
実行時間 1 ms / 2,000 ms
コード長 549 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 1,452 ms
コンパイル使用メモリ 200,480 KB
実行使用メモリ 7,848 KB
最終ジャッジ日時 2026-02-07 13:43:08
合計ジャッジ時間 3,532 ms
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 33
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

fn main() {
    let stdin = std::io::read_to_string(std::io::stdin()).unwrap();
    let mut stdin = stdin.split_ascii_whitespace();

    let t: usize = stdin.next().unwrap().parse().unwrap();
    let x: Vec<i8> = (0..t)
        .map(|_| stdin.next().unwrap().parse().unwrap())
        .collect();

    println!("{}", output(solve(x)));
}

fn solve(x: Vec<i8>) -> bool {
    x[0].abs() == 1 && x.windows(2).all(|x| x[0].abs_diff(x[1]) == 1)
}

fn output(ans: bool) -> &'static str {
    match ans {
        true => "T",
        false => "F",
    }
}
0