結果

問題 No.1974 2x2 Flipper
ユーザー vwxyzvwxyz
提出日時 2023-07-15 13:51:10
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
RE  
実行時間 -
コード長 570 bytes
コンパイル時間 186 ms
コンパイル使用メモリ 12,004 KB
実行使用メモリ 19,156 KB
最終ジャッジ日時 2023-10-16 22:55:27
合計ジャッジ時間 10,025 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 29 ms
10,120 KB
testcase_01 AC 80 ms
11,244 KB
testcase_02 AC 33 ms
10,488 KB
testcase_03 AC 349 ms
15,652 KB
testcase_04 AC 196 ms
13,024 KB
testcase_05 RE -
testcase_06 AC 257 ms
14,104 KB
testcase_07 AC 189 ms
12,900 KB
testcase_08 AC 58 ms
10,864 KB
testcase_09 AC 299 ms
14,620 KB
testcase_10 RE -
testcase_11 AC 237 ms
13,744 KB
testcase_12 AC 388 ms
16,152 KB
testcase_13 AC 243 ms
13,684 KB
testcase_14 AC 159 ms
12,376 KB
testcase_15 AC 447 ms
16,684 KB
testcase_16 RE -
testcase_17 AC 291 ms
14,720 KB
testcase_18 AC 60 ms
10,920 KB
testcase_19 AC 61 ms
10,936 KB
testcase_20 AC 190 ms
12,756 KB
testcase_21 AC 512 ms
18,356 KB
testcase_22 AC 576 ms
19,148 KB
testcase_23 AC 576 ms
19,156 KB
testcase_24 AC 512 ms
18,336 KB
testcase_25 AC 29 ms
10,120 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
readline=sys.stdin.readline

H,W=map(int,readline().split())
if 1 in (H,W):
    ans_lst=[[0]*W for h in range(H)]
elif H%2==0 and W%2==0:
    ans_lst=[[1]*W for h in range(H)]
elif H%2==0:
    ans_lst=[[1 if w!=W-1 else 0 for w in range(W)] for h in range(H)]
elif W%2==0:
    ans_lst=[[1 if h!=H-1 else 0 for w in range(W)] for h in range(H)]
else:
    ans_lst=[[1]*W for h in range(H)]
    for i in range(max(H,W)):
        ans_lst[min(i,H)][min(i,W)]=0
print(sum(ans_lst[h][w] for h in range(H) for w in range(W)))
for h in range(H):
    print(*ans_lst[h])
0