結果

問題 No.1669 パズル作成
ユーザー gew1fw
提出日時 2025-06-12 19:22:32
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 372 bytes
コンパイル時間 205 ms
コンパイル使用メモリ 82,480 KB
実行使用メモリ 76,712 KB
最終ジャッジ日時 2025-06-12 19:22:54
合計ジャッジ時間 3,259 ms
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 3 WA * 26
権限があれば一括ダウンロードができます

ソースコード

diff #

n, m = map(int, input().split())

# Initialize a list to count the number of black cells in each column
black_counts = [0] * (n + 1)  # columns are 1-based

for _ in range(m):
    r, c = map(int, input().split())
    black_counts[c] += 1

result = 0
for c in range(1, n + 1):
    black = black_counts[c]
    white = n - black
    result += min(black, white)

print(result)
0