結果

問題 No.1974 2x2 Flipper
ユーザー vwxyzvwxyz
提出日時 2023-07-15 13:51:25
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 577 ms / 2,000 ms
コード長 574 bytes
コンパイル時間 97 ms
コンパイル使用メモリ 11,984 KB
実行使用メモリ 19,148 KB
最終ジャッジ日時 2023-10-16 22:55:53
合計ジャッジ時間 8,983 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 29 ms
10,112 KB
testcase_01 AC 85 ms
11,236 KB
testcase_02 AC 33 ms
10,480 KB
testcase_03 AC 346 ms
15,644 KB
testcase_04 AC 194 ms
13,016 KB
testcase_05 AC 113 ms
11,768 KB
testcase_06 AC 250 ms
14,096 KB
testcase_07 AC 188 ms
12,892 KB
testcase_08 AC 58 ms
10,856 KB
testcase_09 AC 298 ms
14,612 KB
testcase_10 AC 54 ms
10,840 KB
testcase_11 AC 233 ms
13,736 KB
testcase_12 AC 392 ms
16,144 KB
testcase_13 AC 243 ms
13,676 KB
testcase_14 AC 159 ms
12,368 KB
testcase_15 AC 448 ms
16,676 KB
testcase_16 AC 57 ms
10,676 KB
testcase_17 AC 289 ms
14,712 KB
testcase_18 AC 61 ms
10,912 KB
testcase_19 AC 62 ms
10,928 KB
testcase_20 AC 192 ms
12,748 KB
testcase_21 AC 516 ms
18,348 KB
testcase_22 AC 576 ms
19,140 KB
testcase_23 AC 577 ms
19,148 KB
testcase_24 AC 511 ms
18,328 KB
testcase_25 AC 29 ms
10,112 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-1)][min(i,W-1)]=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