結果

問題 No.1974 2x2 Flipper
ユーザー tktk_snsntktk_snsn
提出日時 2022-06-10 22:12:47
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 662 bytes
コンパイル時間 125 ms
コンパイル使用メモリ 11,892 KB
実行使用メモリ 26,096 KB
最終ジャッジ日時 2023-10-21 05:18:51
合計ジャッジ時間 9,295 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 31 ms
10,220 KB
testcase_01 AC 78 ms
12,104 KB
testcase_02 AC 39 ms
10,584 KB
testcase_03 AC 320 ms
20,816 KB
testcase_04 AC 217 ms
12,868 KB
testcase_05 WA -
testcase_06 AC 233 ms
17,648 KB
testcase_07 AC 207 ms
12,632 KB
testcase_08 AC 65 ms
10,944 KB
testcase_09 AC 328 ms
14,396 KB
testcase_10 WA -
testcase_11 AC 259 ms
13,472 KB
testcase_12 AC 429 ms
15,728 KB
testcase_13 AC 265 ms
13,640 KB
testcase_14 AC 171 ms
12,384 KB
testcase_15 AC 497 ms
16,596 KB
testcase_16 WA -
testcase_17 AC 271 ms
18,704 KB
testcase_18 AC 64 ms
10,784 KB
testcase_19 AC 66 ms
11,040 KB
testcase_20 AC 202 ms
12,808 KB
testcase_21 AC 463 ms
26,096 KB
testcase_22 AC 634 ms
18,456 KB
testcase_23 AC 627 ms
18,448 KB
testcase_24 WA -
testcase_25 AC 30 ms
10,220 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:
    ans = H * W
    G = [[1] * W for _ in range(H)]
elif H % 2 == 0:
    ans = 0
    for i in range(H):
        for j in range(W-1):
            G[i][j] = 1
            ans += 1
elif W % 2 == 0:
    ans = 0
    for i in range(H-1):
        for j in range(W):
            G[i][j] = 1
            ans += 1
else:
    ans = 3
    for i in range(H-1):
        for j in range(W-1):
            ans += 1
            G[i][j] = 1
    G[-1][-1] = 1
    G[-2][-1] = 1
    G[-1][-2] = 1
    G[-2][-2] = 0


print(ans)
for g in G:
    print(*g)
0