結果

問題 No.3430 Flip the Grid
コンテスト
ユーザー urectanc
提出日時 2026-01-11 15:21:40
言語 Rust
(1.92.0 + proconio + num)
結果
WA  
実行時間 -
コード長 659 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 23,438 ms
コンパイル使用メモリ 415,044 KB
実行使用メモリ 35,328 KB
最終ジャッジ日時 2026-01-11 15:22:10
合計ジャッジ時間 25,669 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 3 WA * 7
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

use proconio::input;

fn main() {
    input! {
        h: usize, w: usize,
        mut a: [[usize; w]; h],
    }

    for i in 0..h - 1 {
        for j in 0..w - 1 {
            if a[i][j] == 1 {
                for di in 0..2 {
                    for dj in 0..2 {
                        a[i + di][j + dj] ^= 1;
                    }
                }
            }
        }
    }

    let mut ans = a.iter().flatten().sum::<usize>();
    let mut bottomright = 0;
    for di in 0..2 {
        for dj in 0..2 {
            bottomright += a[h - 2 + di][w - 2 + dj];
        }
    }
    if bottomright == 3 {
        ans -= 2;
    }

    println!("{ans}");
}
0