結果

問題 No.2112 All 2x2 are Equal
ユーザー mkawa2mkawa2
提出日時 2022-10-28 23:29:10
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 1,572 bytes
コンパイル時間 827 ms
コンパイル使用メモリ 87,060 KB
実行使用メモリ 109,944 KB
最終ジャッジ日時 2023-09-20 06:46:48
合計ジャッジ時間 9,230 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 73 ms
71,252 KB
testcase_01 AC 74 ms
71,092 KB
testcase_02 WA -
testcase_03 AC 97 ms
76,264 KB
testcase_04 AC 151 ms
80,896 KB
testcase_05 AC 187 ms
94,444 KB
testcase_06 AC 203 ms
86,624 KB
testcase_07 WA -
testcase_08 WA -
testcase_09 AC 97 ms
77,544 KB
testcase_10 AC 155 ms
88,280 KB
testcase_11 WA -
testcase_12 AC 133 ms
79,736 KB
testcase_13 AC 189 ms
84,944 KB
testcase_14 AC 94 ms
76,436 KB
testcase_15 AC 165 ms
82,636 KB
testcase_16 AC 84 ms
76,184 KB
testcase_17 WA -
testcase_18 AC 93 ms
76,484 KB
testcase_19 WA -
testcase_20 AC 104 ms
77,644 KB
testcase_21 AC 178 ms
83,356 KB
testcase_22 AC 93 ms
76,480 KB
testcase_23 AC 90 ms
76,684 KB
testcase_24 AC 106 ms
79,904 KB
testcase_25 AC 114 ms
80,788 KB
testcase_26 AC 101 ms
77,840 KB
testcase_27 AC 117 ms
78,820 KB
testcase_28 AC 147 ms
81,116 KB
testcase_29 WA -
testcase_30 WA -
testcase_31 WA -
testcase_32 AC 217 ms
86,544 KB
testcase_33 AC 262 ms
109,944 KB
testcase_34 AC 204 ms
86,500 KB
testcase_35 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys

# sys.setrecursionlimit(200005)
int1 = lambda x: int(x)-1
pDB = lambda *x: print(*x, end="\n", file=sys.stderr)
p2D = lambda x: print(*x, sep="\n", end="\n\n", file=sys.stderr)
def II(): return int(sys.stdin.readline())
def LI(): return list(map(int, sys.stdin.readline().split()))
def LLI(rows_number): return [LI() for _ in range(rows_number)]
def LI1(): return list(map(int1, sys.stdin.readline().split()))
def LLI1(rows_number): return [LI1() for _ in range(rows_number)]
def SI(): return sys.stdin.readline().rstrip()

dij = [(0, 1), (-1, 0), (0, -1), (1, 0)]
# dij = [(0, 1), (-1, 0), (0, -1), (1, 0), (1, 1), (1, -1), (-1, 1), (-1, -1)]
inf = (1 << 63)-1
# inf = (1 << 31)-1
# md = 10**9+7
md = 998244353

h, w = LI()

if h == w == 3:
    print("Yes")
    print("1 5 3")
    print("9 8 7")
    print("4 2 6")

elif h & 1 and w & 1:
    print("No")

else:
    rot = False
    if w & 1:
        h, w = w, h
        rot = True

    aa = [[0]*w for _ in range(h)]
    a = 1
    for i in range(h):
        if i & 1:
            for j in range(0, w, 2)[::-1]:
                aa[i][j] = a
                a += 1
        else:
            for j in range(0, w, 2):
                aa[i][j] = a
                a += 1

    for i in range(h)[::-1]:
        if i & 1 == h & 1:
            for j in range(1, w, 2):
                aa[i][j] = a
                a += 1
        else:
            for j in range(1, w, 2)[::-1]:
                aa[i][j] = a
                a += 1

    if rot: aa = [col for col in zip(*aa)]

    print("Yes")
    for a in aa: print(*a)
0