結果

問題 No.26 シャッフルゲーム
ユーザー cra77756176
提出日時 2022-11-18 03:13:51
言語 Rust
(1.83.0 + proconio)
結果
AC  
実行時間 1 ms / 5,000 ms
コード長 499 bytes
コンパイル時間 11,836 ms
コンパイル使用メモリ 402,380 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-09-19 13:22:00
合計ジャッジ時間 12,593 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 10
権限があれば一括ダウンロードができます

ソースコード

diff #

use std::io::{self, BufRead};

fn main() {
    let input = io::stdin()
        .lock()
        .lines()
        .map(|l| {
            l.unwrap()
                .split(' ')
                .map(|n| n.parse::<usize>().unwrap())
                .collect::<Vec<_>>()
        })
        .collect::<Vec<_>>();

    let mut cups = vec![false; 4];
    cups[input[0][0]] = true;

    for i in &input[2..] {
        cups.swap(i[0], i[1]);
    }

    println!("{}", cups.iter().position(|&c| c).unwrap());
}
0