結果

問題 No.3430 Flip the Grid
コンテスト
ユーザー 00 Sakuda
提出日時 2026-02-04 00:35:44
言語 C++23
(gcc 15.2.0 + boost 1.89.0)
結果
AC  
実行時間 703 ms / 2,000 ms
コード長 650 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 5,931 ms
コンパイル使用メモリ 201,692 KB
実行使用メモリ 18,816 KB
最終ジャッジ日時 2026-02-04 00:36:01
合計ジャッジ時間 11,542 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 10
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

#include <iostream>
#include <vector>
#include <iomanip>
#include <map>
#include <set>
#include <numeric>
#include <queue>
#include <deque>
#include <algorithm>
#include <stack>
#include <unordered_map>
using namespace std;
using ll = long long;
int main() {
	int H, W;cin >> H >> W;
	int res1 = 0;
	int res2 = 0;
	vector<vector<int>> A(H, vector<int>(W, 0));
	for (int i = 0;i < H;i++) {
		int sm = 0;
		for (int j = 0;j < W;j++) {
			cin >> A[i][j];
			sm = (sm + A[i][j]) % 2;
		}
		res1 += sm;
	}
	for (int i = 0;i < W;i++) {
		int sm = 0;
		for (int j = 0;j < H;j++) sm = (sm + A[j][i]) % 2;
		res2 += sm;
	}
	cout << max(res1, res2 )<< endl;
}
0