結果

問題 No.351 市松スライドパズル
ユーザー phsplsphspls
提出日時 2020-05-16 21:16:18
言語 Rust
(1.77.0)
結果
AC  
実行時間 238 ms / 2,000 ms
コード長 1,199 bytes
コンパイル時間 2,061 ms
コンパイル使用メモリ 169,672 KB
実行使用メモリ 64,884 KB
最終ジャッジ日時 2023-10-24 02:02:58
合計ジャッジ時間 5,674 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 217 ms
64,884 KB
testcase_01 AC 1 ms
4,348 KB
testcase_02 AC 1 ms
4,348 KB
testcase_03 AC 1 ms
4,348 KB
testcase_04 AC 0 ms
4,348 KB
testcase_05 AC 1 ms
4,348 KB
testcase_06 AC 1 ms
4,348 KB
testcase_07 AC 1 ms
4,348 KB
testcase_08 AC 1 ms
4,348 KB
testcase_09 AC 1 ms
4,348 KB
testcase_10 AC 1 ms
4,348 KB
testcase_11 AC 1 ms
4,348 KB
testcase_12 AC 1 ms
4,348 KB
testcase_13 AC 231 ms
64,092 KB
testcase_14 AC 233 ms
64,356 KB
testcase_15 AC 237 ms
64,884 KB
testcase_16 AC 237 ms
64,884 KB
testcase_17 AC 230 ms
64,884 KB
testcase_18 AC 230 ms
64,884 KB
testcase_19 AC 238 ms
64,884 KB
testcase_20 AC 237 ms
64,884 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

fn main() {
   let mut hw = String::new();
   std::io::stdin().read_line(&mut hw).ok();
   let hw: Vec<usize> = hw.trim().split_whitespace().map(|s| s.parse().unwrap()).collect(); 
   let h = hw[0];
   let w = hw[1];
   let mut n = String::new();
   std::io::stdin().read_line(&mut n).ok();
   let n: usize = n.trim().parse().unwrap();
   let mut op: Vec<(String, usize)> = vec![];
   for _ in 0..n {
       let mut sk = String::new();
       std::io::stdin().read_line(&mut sk).ok();
       let mut sk = sk.trim().split_whitespace();
       let s: String = sk.next().unwrap().to_string();
       let k: usize = sk.next().unwrap().parse().unwrap();
       op.push((s, k));
   }
   let mut lu: (usize, usize) = (0, 0);
   for pair in op.iter().rev() {
        if pair.0 == "R".to_string() && pair.1 == lu.0 {
            if lu.1 == 0 {
                lu.1 = w-1;
            } else {
                lu.1 -= 1;
            }
        } else if pair.0 == "C".to_string() && pair.1 == lu.1 {
            if lu.0 == 0 {
                lu.0 = h-1;
            } else {
                lu.0 -= 1;
            }
        }
   }
   println!("{}", if (lu.0 + lu.1) % 2 == 0 { "white" } else { "black" } );
}
0