結果

問題 No.2112 All 2x2 are Equal
ユーザー ntudantuda
提出日時 2022-10-29 14:04:32
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 239 ms / 2,000 ms
コード長 443 bytes
コンパイル時間 307 ms
コンパイル使用メモリ 87,044 KB
実行使用メモリ 121,460 KB
最終ジャッジ日時 2023-09-20 18:08:36
合計ジャッジ時間 11,594 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 76 ms
70,852 KB
testcase_01 AC 75 ms
71,312 KB
testcase_02 AC 93 ms
76,568 KB
testcase_03 AC 91 ms
76,480 KB
testcase_04 AC 158 ms
93,572 KB
testcase_05 AC 179 ms
100,456 KB
testcase_06 AC 231 ms
116,348 KB
testcase_07 AC 141 ms
88,460 KB
testcase_08 AC 207 ms
107,916 KB
testcase_09 AC 99 ms
77,760 KB
testcase_10 AC 148 ms
91,296 KB
testcase_11 AC 128 ms
86,488 KB
testcase_12 AC 142 ms
88,076 KB
testcase_13 AC 219 ms
111,652 KB
testcase_14 AC 97 ms
77,476 KB
testcase_15 AC 184 ms
101,440 KB
testcase_16 AC 90 ms
76,272 KB
testcase_17 AC 206 ms
107,816 KB
testcase_18 AC 96 ms
76,076 KB
testcase_19 AC 103 ms
78,516 KB
testcase_20 AC 98 ms
76,652 KB
testcase_21 AC 199 ms
107,536 KB
testcase_22 AC 97 ms
77,284 KB
testcase_23 AC 92 ms
76,492 KB
testcase_24 AC 111 ms
79,724 KB
testcase_25 AC 111 ms
80,872 KB
testcase_26 AC 107 ms
79,244 KB
testcase_27 AC 125 ms
83,620 KB
testcase_28 AC 161 ms
95,312 KB
testcase_29 AC 112 ms
78,724 KB
testcase_30 AC 141 ms
88,404 KB
testcase_31 AC 187 ms
100,916 KB
testcase_32 AC 239 ms
120,952 KB
testcase_33 AC 237 ms
121,188 KB
testcase_34 AC 239 ms
121,316 KB
testcase_35 AC 237 ms
121,460 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

H,W = map(int,input().split())
A = [[0] * W for _ in range(H)]
HW = H * W
D = (HW % 2) ^ 1
R = []
for i in range(HW):
        w = i % W
        h = i // W
        if (h - w) % 2 == 0:
            A[h][w] = i + 1
        else:
            R.append(i+1)
R.sort(reverse = True)
i = 0
for h in range(H):
    for w in range(W):
        if A[h][w] == 0:
            A[h][w] = R[i]
            i += 1
print("Yes")
for i in range(H):
    print(*A[i])
0