結果

問題 No.1974 2x2 Flipper
ユーザー tktk_snsntktk_snsn
提出日時 2022-06-10 22:14:02
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 576 bytes
コンパイル時間 469 ms
コンパイル使用メモリ 11,872 KB
実行使用メモリ 26,044 KB
最終ジャッジ日時 2023-10-21 05:19:30
合計ジャッジ時間 9,538 ms
ジャッジサーバーID
(参考情報)
judge9 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 32 ms
10,164 KB
testcase_01 AC 76 ms
12,052 KB
testcase_02 AC 35 ms
10,532 KB
testcase_03 AC 325 ms
20,764 KB
testcase_04 AC 191 ms
12,816 KB
testcase_05 WA -
testcase_06 AC 235 ms
17,596 KB
testcase_07 AC 190 ms
12,580 KB
testcase_08 AC 60 ms
10,888 KB
testcase_09 AC 289 ms
14,340 KB
testcase_10 WA -
testcase_11 AC 232 ms
13,420 KB
testcase_12 AC 380 ms
15,676 KB
testcase_13 AC 239 ms
13,588 KB
testcase_14 AC 155 ms
12,336 KB
testcase_15 AC 442 ms
16,540 KB
testcase_16 WA -
testcase_17 AC 269 ms
18,652 KB
testcase_18 AC 61 ms
10,732 KB
testcase_19 AC 63 ms
10,984 KB
testcase_20 AC 188 ms
12,760 KB
testcase_21 AC 471 ms
26,044 KB
testcase_22 AC 563 ms
18,404 KB
testcase_23 AC 562 ms
18,396 KB
testcase_24 WA -
testcase_25 AC 30 ms
10,164 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

H, W = map(int, input().split())
G = [[0] * W for _ in range(H)]

if H == 1 or W == 1:
    ans = 0
elif H % 2 == 0 and W % 2 == 0:
    G = [[1] * W for _ in range(H)]
elif H % 2 == 0:
    for i in range(H):
        for j in range(W-1):
            G[i][j] = 1
elif W % 2 == 0:
    for i in range(H-1):
        for j in range(W):
            G[i][j] = 1
else:
    for i in range(H-1):
        for j in range(W-1):
            G[i][j] = 1
    G[-1][-1] = 1
    G[-2][-1] = 1
    G[-1][-2] = 1
    G[-2][-2] = 0


ans = sum(sum(d) for d in G)
print(ans)
for g in G:
    print(*g)
0