結果

問題 No.1974 2x2 Flipper
ユーザー taiga0629kyoprotaiga0629kyopro
提出日時 2022-06-12 10:56:53
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 153 ms / 2,000 ms
コード長 702 bytes
コンパイル時間 1,124 ms
コンパイル使用メモリ 81,788 KB
実行使用メモリ 85,632 KB
最終ジャッジ日時 2023-10-24 04:26:23
合計ジャッジ時間 5,981 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 39 ms
53,512 KB
testcase_01 AC 68 ms
76,572 KB
testcase_02 AC 50 ms
64,292 KB
testcase_03 AC 122 ms
82,104 KB
testcase_04 AC 87 ms
78,408 KB
testcase_05 AC 74 ms
77,352 KB
testcase_06 AC 102 ms
79,924 KB
testcase_07 AC 87 ms
78,524 KB
testcase_08 AC 59 ms
74,216 KB
testcase_09 AC 103 ms
80,340 KB
testcase_10 AC 59 ms
73,856 KB
testcase_11 AC 92 ms
78,996 KB
testcase_12 AC 120 ms
82,072 KB
testcase_13 AC 97 ms
79,340 KB
testcase_14 AC 79 ms
77,712 KB
testcase_15 AC 130 ms
83,176 KB
testcase_16 AC 63 ms
76,144 KB
testcase_17 AC 109 ms
80,920 KB
testcase_18 AC 55 ms
73,256 KB
testcase_19 AC 64 ms
76,220 KB
testcase_20 AC 83 ms
78,320 KB
testcase_21 AC 149 ms
85,504 KB
testcase_22 AC 153 ms
85,476 KB
testcase_23 AC 153 ms
85,632 KB
testcase_24 AC 152 ms
85,524 KB
testcase_25 AC 38 ms
53,512 KB
権限があれば一括ダウンロードができます

ソースコード

diff #


h,w=map(int,input().split())
s=[[1]*w for i in range(h)]
def put(s):
    for l in s:print(*l)
def cnt(s):
    res=0
    for i in range(h):
        for j in range(w):res+=s[i][j]
    print(res)
if h%2==w%2==0:
    cnt(s)
    put(s)
elif h%2==0 and w%2==1:
    for i in range(h):s[i][0]=0
    cnt(s)
    put(s)
elif h%2==1 and w%2==0:
    for j in range(w):s[0][j]=0
    cnt(s)
    put(s)
else:
    if h<w:
        for j in range(w-h):
            s[0][j]=0
        for j in range(w-h,w):
            s[(j-w+h)%h][j]=0
        cnt(s)
        put(s)
    else:
        for i in range(h-w):
            s[i][0]=0
        for i in range(h-w,h):
            s[i][(i-h+w)%w]=0
        cnt(s)
        put(s)

0