結果

問題 No.3622 Perfect Matching of Crab
コンテスト
ユーザー urectanc
提出日時 2026-08-14 21:31:01
言語 Rust
(1.94.0 + proconio + num + itertools)
コンパイル:
/usr/bin/rustc_custom
実行:
./target/release/main
結果
WA  
実行時間 -
コード長 653 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 10,078 ms
コンパイル使用メモリ 203,696 KB
実行使用メモリ 12,552 KB
最終ジャッジ日時 2026-08-14 21:31:22
合計ジャッジ時間 12,763 ms
ジャッジサーバーID
(参考情報)
judge2_0 / judge1_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 9 WA * 7
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

use std::collections::HashMap;

use proconio::{fastout, input, marker::Usize1};

#[fastout]
fn main() {
    input! { t: usize }

    for _ in 0..t {
        let ans = solve();
        println!("{}", if ans { "Yes" } else { "No" });
    }
}

fn solve() -> bool {
    input! {
        n: usize,
        xyc: [(Usize1, Usize1, char); 2* n],
    }

    let mut row = HashMap::new();
    let mut col = HashMap::new();
    for &(x, y, c) in &xyc {
        if c == 'x' {
            *row.entry(y).or_insert(0) ^= 1;
        } else {
            *col.entry(x).or_insert(0) ^= 1;
        }
    }

    row.values().sum::<usize>() == col.values().sum::<usize>()
}
0