結果

問題 No.2112 All 2x2 are Equal
ユーザー 👑 rin204rin204
提出日時 2022-10-28 21:48:44
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 283 ms / 2,000 ms
コード長 782 bytes
コンパイル時間 519 ms
コンパイル使用メモリ 86,588 KB
実行使用メモリ 102,304 KB
最終ジャッジ日時 2023-09-20 04:42:14
合計ジャッジ時間 11,023 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 75 ms
71,056 KB
testcase_01 AC 74 ms
71,248 KB
testcase_02 AC 108 ms
77,888 KB
testcase_03 AC 97 ms
76,752 KB
testcase_04 AC 174 ms
87,688 KB
testcase_05 AC 191 ms
90,320 KB
testcase_06 AC 258 ms
100,408 KB
testcase_07 AC 155 ms
84,736 KB
testcase_08 AC 227 ms
96,124 KB
testcase_09 AC 105 ms
78,392 KB
testcase_10 AC 163 ms
86,008 KB
testcase_11 AC 142 ms
83,604 KB
testcase_12 AC 154 ms
84,308 KB
testcase_13 AC 234 ms
97,968 KB
testcase_14 AC 105 ms
78,148 KB
testcase_15 AC 200 ms
92,072 KB
testcase_16 AC 89 ms
76,748 KB
testcase_17 AC 224 ms
95,536 KB
testcase_18 AC 106 ms
76,900 KB
testcase_19 AC 113 ms
79,008 KB
testcase_20 AC 109 ms
78,072 KB
testcase_21 AC 220 ms
94,692 KB
testcase_22 AC 106 ms
78,260 KB
testcase_23 AC 98 ms
76,748 KB
testcase_24 AC 120 ms
79,560 KB
testcase_25 AC 122 ms
80,412 KB
testcase_26 AC 110 ms
79,120 KB
testcase_27 AC 131 ms
81,808 KB
testcase_28 AC 176 ms
88,312 KB
testcase_29 AC 120 ms
79,256 KB
testcase_30 AC 150 ms
84,788 KB
testcase_31 AC 197 ms
91,188 KB
testcase_32 AC 274 ms
102,008 KB
testcase_33 AC 283 ms
101,668 KB
testcase_34 AC 263 ms
101,976 KB
testcase_35 AC 269 ms
102,304 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

h, w = map(int, input().split())

A = [[0] * w for _ in range(h)]
for i in range(h):
    for j in range(w):
        x = i * w + j + 1
        A[i][j] = x
        x += 1

B = [[0] * w for _ in range(h)]
for i in range(h):
    for j in range(w):
        if i & 1:
            jj = w - 1 - j
        else:
            jj = j
        x = A[i][jj]
        B[i][j] = x
        x += 1

A = [[0] * w for _ in range(h)]
for i in range(h):
    for j in range(w):
        if j & 1:
            ii = h - 1 - i
        else:
            ii = i
        x = B[ii][j]
        A[i][j] = x
        x += 1

print("Yes")
for row in A:
    print(*row)

se = set()
for i in range(h - 1):
    for j in range(w - 1):
        se.add(A[i][j] + A[i + 1][j] + A[i][j + 1] + A[i + 1][j + 1])
assert len(se) == 1
0