結果
問題 |
No.923 オセロきりきざむたん
|
ユーザー |
![]() |
提出日時 | 2025-06-12 17:07:38 |
言語 | PyPy3 (7.3.15) |
結果 |
WA
|
実行時間 | - |
コード長 | 1,066 bytes |
コンパイル時間 | 166 ms |
コンパイル使用メモリ | 82,412 KB |
実行使用メモリ | 100,364 KB |
最終ジャッジ日時 | 2025-06-12 17:07:47 |
合計ジャッジ時間 | 6,451 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 36 WA * 48 |
ソースコード
def main(): import sys input = sys.stdin.read data = input().split() H = int(data[0]) W = int(data[1]) grid = data[2:] # Check if the entire grid is already all 1s all_ones = True for row in grid: if '0' in row: all_ones = False break if all_ones: if H * W == 1: print("YES") else: print("NO") return # Calculate the required flips F_ij = 1 - A_ij required = [] for row in grid: req = [] for c in row: req.append(1 - int(c)) required.append(req) # Check for possible configurations # We need to determine if the required flips can be achieved # through a series of splits and mandatory flips. # For this problem, the solution is to check if the sum of all required flips is even. total = 0 for row in required: total += sum(row) if total % 2 == 0: print("YES") else: print("NO") if __name__ == "__main__": main()