結果

問題 No.870 無敵囲い
ユーザー pod1pod1
提出日時 2019-09-08 01:05:14
言語 Rust
(1.77.0)
結果
WA  
実行時間 -
コード長 1,020 bytes
コンパイル時間 1,000 ms
コンパイル使用メモリ 148,652 KB
実行使用メモリ 4,384 KB
最終ジャッジ日時 2023-09-11 16:17:19
合計ジャッジ時間 1,650 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,380 KB
testcase_01 WA -
testcase_02 AC 1 ms
4,380 KB
testcase_03 AC 1 ms
4,380 KB
testcase_04 AC 1 ms
4,380 KB
testcase_05 AC 1 ms
4,376 KB
testcase_06 AC 1 ms
4,380 KB
testcase_07 AC 1 ms
4,376 KB
testcase_08 AC 1 ms
4,376 KB
testcase_09 AC 1 ms
4,376 KB
testcase_10 AC 1 ms
4,380 KB
testcase_11 AC 1 ms
4,380 KB
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 AC 1 ms
4,376 KB
testcase_16 AC 1 ms
4,376 KB
testcase_17 AC 1 ms
4,376 KB
testcase_18 AC 1 ms
4,376 KB
testcase_19 AC 1 ms
4,376 KB
testcase_20 WA -
権限があれば一括ダウンロードができます
コンパイルメッセージ
warning: unused import: `std::cmp::min`
 --> Main.rs:2:5
  |
2 | use std::cmp::min;
  |     ^^^^^^^^^^^^^
  |
  = note: `#[warn(unused_imports)]` on by default

warning: unused import: `std::cmp::max`
 --> Main.rs:3:5
  |
3 | use std::cmp::max;
  |     ^^^^^^^^^^^^^

warning: 2 warnings emitted

ソースコード

diff #

use std::vec::Vec;
use std::cmp::min;
use std::cmp::max;


fn read<T: std::str::FromStr>() -> T {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().parse().ok().unwrap()
}

fn read_vec<T: std::str::FromStr>() -> Vec<T> {
    read::<String>().split_whitespace().map(|e| e.parse().ok().unwrap()).collect()
}

fn main() {
  let n: usize = read();
  let mut process: Vec<((usize, usize), (usize, usize))>  = Vec::new();
  let mut board: Vec<Vec<bool>> = vec![vec![false; 9]; 9];
  board[1][7] = true;
  board[2][8] = true;
  board[6][8] = true;
  for _ in 0..n {
    let v: Vec<usize> = read_vec();
    process.push(((v[0] - 1, v[1] - 1), (v[2] - 1, v[3] - 1)));
  }

  for (now, next) in process {
    moving(&mut board, now, next);
  }

  if board[4][7] && board[3][7] && board[5][7] {
    println!("YES");
  } else {
    println!("NO");
  }

}


fn moving(b: &mut Vec<Vec<bool>>, now: (usize, usize), next: (usize, usize)) {
  b[now.0][now.1] = false;
  b[next.0][next.1] = true;
}
0