結果

問題 No.1974 2x2 Flipper
ユーザー pitPpitP
提出日時 2022-06-10 22:40:02
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 736 bytes
コンパイル時間 157 ms
コンパイル使用メモリ 81,612 KB
実行使用メモリ 85,496 KB
最終ジャッジ日時 2023-10-21 05:29:53
合計ジャッジ時間 5,722 ms
ジャッジサーバーID
(参考情報)
judge15 / judge10
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 39 ms
53,284 KB
testcase_01 AC 77 ms
76,420 KB
testcase_02 AC 52 ms
64,200 KB
testcase_03 AC 127 ms
81,812 KB
testcase_04 AC 93 ms
78,272 KB
testcase_05 WA -
testcase_06 AC 110 ms
79,892 KB
testcase_07 AC 94 ms
78,308 KB
testcase_08 AC 67 ms
75,948 KB
testcase_09 AC 111 ms
80,164 KB
testcase_10 WA -
testcase_11 AC 100 ms
79,044 KB
testcase_12 AC 129 ms
81,680 KB
testcase_13 AC 105 ms
79,344 KB
testcase_14 AC 86 ms
77,596 KB
testcase_15 AC 138 ms
82,716 KB
testcase_16 WA -
testcase_17 AC 120 ms
80,576 KB
testcase_18 AC 60 ms
73,516 KB
testcase_19 AC 70 ms
76,020 KB
testcase_20 AC 91 ms
78,180 KB
testcase_21 AC 163 ms
85,452 KB
testcase_22 AC 164 ms
85,424 KB
testcase_23 AC 165 ms
85,324 KB
testcase_24 WA -
testcase_25 AC 40 ms
53,284 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

def print_ans(): 
    for l in ans:
        print(*l)
    return

h,w = map(int,input().split())
ans = [[0 for _ in range(w)] for _ in range(h)]
if h == 1 or w == 1:
    print(0)
    print_ans()
elif h%2 == 0 and w%2 == 0:
    for i in range(h):
        for j in range(w):
            ans[i][j] = 1
    print(h*w)
    print_ans()
elif h%2 == 0 and w%2 == 1:
    for i in range(h):
        for j in range(w-1):
            ans[i][j] = 1
    print(h*(w-1))
    print_ans()
elif h%2 == 1 and w%2 == 0:
    for i in range(h-1):
        for j in range(w):
            ans[i][j] = 1
    print((h-1)*w)
    print_ans()
else:
    for i in range(h-1):
        for j in range(w-1):
            ans[i][j] = 1
    print((h-1)*(w-1))
    print_ans()
0