結果

問題 No.1974 2x2 Flipper
ユーザー 👑 KazunKazun
提出日時 2022-06-10 22:07:18
言語 PyPy3
(7.3.15)
結果
RE  
実行時間 -
コード長 875 bytes
コンパイル時間 171 ms
コンパイル使用メモリ 81,696 KB
実行使用メモリ 85,644 KB
最終ジャッジ日時 2023-10-21 05:13:53
合計ジャッジ時間 5,521 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 41 ms
53,480 KB
testcase_01 AC 73 ms
76,592 KB
testcase_02 AC 52 ms
64,272 KB
testcase_03 AC 135 ms
81,996 KB
testcase_04 AC 90 ms
78,372 KB
testcase_05 RE -
testcase_06 AC 108 ms
80,012 KB
testcase_07 AC 96 ms
78,464 KB
testcase_08 AC 68 ms
76,108 KB
testcase_09 AC 109 ms
80,264 KB
testcase_10 RE -
testcase_11 AC 95 ms
79,144 KB
testcase_12 AC 116 ms
81,844 KB
testcase_13 AC 97 ms
79,516 KB
testcase_14 AC 79 ms
77,760 KB
testcase_15 AC 125 ms
82,892 KB
testcase_16 RE -
testcase_17 AC 112 ms
80,744 KB
testcase_18 AC 55 ms
73,504 KB
testcase_19 AC 67 ms
76,172 KB
testcase_20 AC 85 ms
78,352 KB
testcase_21 AC 149 ms
85,336 KB
testcase_22 AC 153 ms
85,644 KB
testcase_23 AC 148 ms
85,536 KB
testcase_24 RE -
testcase_25 AC 37 ms
53,480 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

def solve(H,W):
    A=[[0]*W for _ in range(H)]

    if H==1 or W==1:
        pass
    elif H%2==0:
        if W%2==0:
            for i in range(H):
                a=A[i]
                for j in range(W):
                    a[j]=1
        else:
            for i in range(H):
                a=A[i]
                for j in range(W-1):
                    a[j]=1
    else:
        if W%2==0:
            for i in range(H-1):
                a=A[i]
                for j in range(W):
                    a[j]=1
        else:
            assert 0
            for i in range(H-1):
                a=A[i]
                for j in range(W-1):
                    a[j]=1
            A[-2][-2]=0
            A[-2][-1]=A[-1][-2]=A[-1][-1]=1
    X=0
    for a in A:
        X+=sum(a)
    return X,A

H,W=map(int,input().split())
X,A=solve(H,W)

print(X)
for a in A:
    print(*a)
0