結果
問題 |
No.1974 2x2 Flipper
|
ユーザー |
![]() |
提出日時 | 2025-06-12 18:59:02 |
言語 | PyPy3 (7.3.15) |
結果 |
WA
|
実行時間 | - |
コード長 | 826 bytes |
コンパイル時間 | 159 ms |
コンパイル使用メモリ | 82,772 KB |
実行使用メモリ | 85,412 KB |
最終ジャッジ日時 | 2025-06-12 18:59:11 |
合計ジャッジ時間 | 5,084 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 |
other | AC * 20 WA * 5 |
ソースコード
H, W = map(int, input().split()) ans = 0 grid = [] if H % 2 == 0 and W % 2 == 0: ans = H * W grid = [[1] * W for _ in range(H)] elif H % 2 == 0: # W is odd ans = H * (W - 1) for _ in range(H): row = [1] * (W - 1) + [0] grid.append(row) elif W % 2 == 0: # H is odd ans = (H - 1) * W for _ in range(H - 1): grid.append([1] * W) grid.append([0] * W) else: # Both are odd ans = (H - 1) * (W - 1) + (H - 1) + (W - 1) for i in range(H): row = [] for j in range(W): if i < H - 1 and j < W - 1: row.append(1) elif i < H - 1 or j < W - 1: row.append(1) else: row.append(0) grid.append(row) print(ans) for row in grid: print(' '.join(map(str, row)))