結果

問題 No.2112 All 2x2 are Equal
ユーザー shotoyooshotoyoo
提出日時 2022-10-28 21:55:17
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 228 ms / 2,000 ms
コード長 1,372 bytes
コンパイル時間 364 ms
コンパイル使用メモリ 86,964 KB
実行使用メモリ 86,288 KB
最終ジャッジ日時 2023-09-20 04:50:10
合計ジャッジ時間 10,704 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 95 ms
72,068 KB
testcase_01 AC 96 ms
71,936 KB
testcase_02 AC 141 ms
78,196 KB
testcase_03 AC 118 ms
77,884 KB
testcase_04 AC 166 ms
81,608 KB
testcase_05 AC 175 ms
82,252 KB
testcase_06 AC 220 ms
85,728 KB
testcase_07 AC 149 ms
80,792 KB
testcase_08 AC 198 ms
83,976 KB
testcase_09 AC 118 ms
78,356 KB
testcase_10 AC 157 ms
81,144 KB
testcase_11 AC 145 ms
79,868 KB
testcase_12 AC 148 ms
80,528 KB
testcase_13 AC 204 ms
84,912 KB
testcase_14 AC 116 ms
78,584 KB
testcase_15 AC 181 ms
83,068 KB
testcase_16 AC 99 ms
76,504 KB
testcase_17 AC 196 ms
84,308 KB
testcase_18 AC 112 ms
78,128 KB
testcase_19 AC 121 ms
78,772 KB
testcase_20 AC 117 ms
77,956 KB
testcase_21 AC 194 ms
83,772 KB
testcase_22 AC 119 ms
78,268 KB
testcase_23 AC 123 ms
78,192 KB
testcase_24 AC 129 ms
78,920 KB
testcase_25 AC 127 ms
79,332 KB
testcase_26 AC 124 ms
78,872 KB
testcase_27 AC 137 ms
79,956 KB
testcase_28 AC 165 ms
81,436 KB
testcase_29 AC 123 ms
79,056 KB
testcase_30 AC 150 ms
80,740 KB
testcase_31 AC 180 ms
82,364 KB
testcase_32 AC 224 ms
86,216 KB
testcase_33 AC 228 ms
86,132 KB
testcase_34 AC 223 ms
86,288 KB
testcase_35 AC 225 ms
86,288 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys, random
input = lambda : sys.stdin.readline().rstrip()


write = lambda x: sys.stdout.write(x+"\n"); writef = lambda x: print("{:.12f}".format(x))
debug = lambda x: sys.stderr.write(x+"\n")
YES="Yes"; NO="No"; pans = lambda v: print(YES if v else NO); INF=10**18
LI = lambda : list(map(int, input().split())); II=lambda : int(input()); SI=lambda : [ord(c)-ord("a") for c in input()]
def debug(_l_):
    for s in _l_.split():
        print(f"{s}={eval(s)}", end=" ")
    print()
def dlist(*l, fill=0):
    if len(l)==1:
        return [fill]*l[0]
    ll = l[1:]
    return [dlist(*ll, fill=fill) for _ in range(l[0])]

h,w = list(map(int, input().split()))
ans = [[0]*w for _ in range(h)]
v = 1
for i in range(0,h,2):
    for j in range(w):
        ans[i][j] = v
        v += 1
for i in range(1,h,2):
    for j in range(w)[::-1]:
        ans[i][j] = v
        v += 1
for j in range(0,w,2):
    vs = []
    for i in range(1,h,2):
        vs.append(ans[i][j])
    for i in range(1,h,2):
        ans[i][j] = vs.pop()
for j in range(1,w,2):
    vs = []
    for i in range(0,h,2):
        vs.append(ans[i][j])
    for i in range(0,h,2):
        ans[i][j] = vs.pop()
s = set()
for i in range(h-1):
    for j in range(w-1):
        s.add(ans[i][j]+ans[i+1][j]+ans[i][j+1]+ans[i+1][j+1])
assert len(s)==1
print("Yes")
for item in ans:
    write(" ".join(map(str, item)))
0