結果

問題 No.870 無敵囲い
ユーザー phsplsphspls
提出日時 2022-12-06 13:13:43
言語 Rust
(1.77.0)
結果
AC  
実行時間 1 ms / 300 ms
コード長 856 bytes
コンパイル時間 7,058 ms
コンパイル使用メモリ 141,824 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-04-21 06:00:58
合計ジャッジ時間 1,592 ms
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

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

warning: 1 warning emitted

ソースコード

diff #

use std::mem::swap;


fn main() {
    let mut n = String::new();
    std::io::stdin().read_line(&mut n).ok();
    let n: usize = n.trim().parse().unwrap();
    let queries = (0..n).map(|_| {
            let mut temp = String::new();
            std::io::stdin().read_line(&mut temp).ok();
            let temp: Vec<usize> = temp.trim().split_whitespace().map(|s| s.parse().unwrap()).collect();
            (temp[0]-1, temp[1]-1, temp[2]-1, temp[3]-1)
        })
        .collect::<Vec<_>>();

    let mut grid = (0..9).map(|i| (0..9).map(|j| i*9+j).collect::<Vec<_>>()).collect::<Vec<_>>();
    for &(sx, sy, gx, gy) in queries.iter() {
        (grid[gx][gy], grid[sx][sy]) = (grid[sx][sy], grid[gx][gy]);
    }
    if grid[4][7] == 1*9+7 && grid[3][7] == 2*9+8 && grid[5][7] == 6*9+8 {
        println!("YES");
    } else {
        println!("NO");
    }
}
0