結果

問題 No.3430 Flip the Grid
コンテスト
ユーザー GOTKAKO
提出日時 2026-01-11 14:29:48
言語 C++17
(gcc 15.2.0 + boost 1.89.0)
結果
AC  
実行時間 270 ms / 2,000 ms
コード長 538 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 1,995 ms
コンパイル使用メモリ 217,188 KB
実行使用メモリ 19,072 KB
最終ジャッジ日時 2026-01-11 14:29:53
合計ジャッジ時間 4,573 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 10
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

#include <bits/stdc++.h>
using namespace std;

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);

    int H,W; cin >> H >> W;
    vector<vector<int>> A(H,vector<int>(W));
    for(auto &h : A) for(auto &w : h) cin >> w;

    vector<int> X(H),Y(W);
    for(int i=0; i<H; i++) for(int k=0; k<W; k++) X.at(i) ^= A.at(i).at(k);
    for(int i=0; i<H; i++) for(int k=0; k<W; k++) Y.at(k) ^= A.at(i).at(k);

    int answer = max(accumulate(X.begin(),X.end(),0),accumulate(Y.begin(),Y.end(),0));
    cout << answer << endl;
}
0