結果

問題 No.1974 2x2 Flipper
ユーザー pitPpitP
提出日時 2022-06-10 22:41:47
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 830 bytes
コンパイル時間 166 ms
コンパイル使用メモリ 81,780 KB
実行使用メモリ 85,692 KB
最終ジャッジ日時 2023-10-21 05:31:04
合計ジャッジ時間 5,799 ms
ジャッジサーバーID
(参考情報)
judge9 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 40 ms
53,520 KB
testcase_01 AC 71 ms
76,676 KB
testcase_02 AC 56 ms
64,440 KB
testcase_03 AC 126 ms
82,052 KB
testcase_04 AC 91 ms
78,516 KB
testcase_05 WA -
testcase_06 AC 112 ms
80,140 KB
testcase_07 AC 93 ms
78,476 KB
testcase_08 AC 65 ms
76,180 KB
testcase_09 AC 109 ms
80,404 KB
testcase_10 WA -
testcase_11 AC 99 ms
79,280 KB
testcase_12 AC 130 ms
81,876 KB
testcase_13 AC 103 ms
79,560 KB
testcase_14 AC 83 ms
77,832 KB
testcase_15 AC 138 ms
83,148 KB
testcase_16 WA -
testcase_17 AC 120 ms
80,888 KB
testcase_18 AC 57 ms
73,792 KB
testcase_19 AC 68 ms
76,252 KB
testcase_20 AC 88 ms
78,416 KB
testcase_21 AC 156 ms
85,692 KB
testcase_22 AC 157 ms
85,660 KB
testcase_23 AC 161 ms
85,564 KB
testcase_24 WA -
testcase_25 AC 39 ms
53,520 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
    
    ans[-1][-1] = 1
    ans[-1][-2] = 1
    ans[-2][-1] = 1
    ans[-2][-2] = 0
    
    print((h-1)*(w-1) + 2)
    print_ans()
0