結果

問題 No.1974 2x2 Flipper
ユーザー rlangevinrlangevin
提出日時 2022-08-22 19:49:04
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 538 bytes
コンパイル時間 308 ms
コンパイル使用メモリ 82,300 KB
実行使用メモリ 86,384 KB
最終ジャッジ日時 2024-04-18 13:29:36
合計ジャッジ時間 5,580 ms
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 35 ms
52,096 KB
testcase_01 AC 68 ms
76,672 KB
testcase_02 AC 54 ms
65,152 KB
testcase_03 AC 119 ms
82,692 KB
testcase_04 AC 83 ms
79,104 KB
testcase_05 WA -
testcase_06 AC 105 ms
80,608 KB
testcase_07 AC 87 ms
78,720 KB
testcase_08 AC 67 ms
76,416 KB
testcase_09 AC 102 ms
81,152 KB
testcase_10 WA -
testcase_11 AC 93 ms
79,744 KB
testcase_12 AC 118 ms
82,304 KB
testcase_13 AC 96 ms
79,744 KB
testcase_14 AC 80 ms
78,464 KB
testcase_15 AC 127 ms
83,712 KB
testcase_16 WA -
testcase_17 AC 112 ms
81,152 KB
testcase_18 AC 57 ms
76,544 KB
testcase_19 AC 69 ms
76,800 KB
testcase_20 AC 86 ms
78,592 KB
testcase_21 AC 155 ms
85,888 KB
testcase_22 AC 153 ms
85,888 KB
testcase_23 AC 155 ms
86,304 KB
testcase_24 WA -
testcase_25 AC 36 ms
52,480 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

H, W = map(int, input().split())
G = [[0] * W for i in range(H)]
ans = 0
for i in range(H - 1):
    for j in range(W - 1):
        if G[i][j] + G[i][j + 1] + G[i + 1][j] + G[i + 1][j + 1] == 0:
            ans += 4
            G[i][j] = 1
            G[i][j + 1] = 1
            G[i + 1][j] = 1
            G[i + 1][j + 1] = 1
print(ans)
if H % 2 and W % 2 and H >= 3 and W >= 3:
    ans += 3
    G[H - 1][W - 1] ^= 1
    G[H - 1][W - 2] ^= 1
    G[H - 2][W - 1] ^= 1
    G[H - 2][W - 2] ^= 1
    
    
for i in range(H):
    print(*G[i])
0