結果

問題 No.2112 All 2x2 are Equal
ユーザー 👑 tamatotamato
提出日時 2022-10-28 22:39:31
言語 PyPy3
(7.3.13)
結果
AC  
実行時間 247 ms / 2,000 ms
コード長 750 bytes
コンパイル時間 279 ms
コンパイル使用メモリ 87,280 KB
実行使用メモリ 124,748 KB
最終ジャッジ日時 2023-09-20 05:46:37
合計ジャッジ時間 10,057 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 72 ms
71,172 KB
testcase_01 AC 73 ms
71,156 KB
testcase_02 AC 95 ms
76,452 KB
testcase_03 AC 91 ms
76,588 KB
testcase_04 AC 165 ms
95,184 KB
testcase_05 AC 179 ms
103,136 KB
testcase_06 AC 237 ms
119,956 KB
testcase_07 AC 140 ms
89,516 KB
testcase_08 AC 214 ms
111,244 KB
testcase_09 AC 97 ms
78,084 KB
testcase_10 AC 150 ms
92,736 KB
testcase_11 AC 130 ms
87,616 KB
testcase_12 AC 146 ms
89,264 KB
testcase_13 AC 226 ms
115,428 KB
testcase_14 AC 96 ms
77,440 KB
testcase_15 AC 186 ms
103,912 KB
testcase_16 AC 85 ms
76,432 KB
testcase_17 AC 210 ms
111,044 KB
testcase_18 AC 92 ms
76,396 KB
testcase_19 AC 106 ms
78,952 KB
testcase_20 AC 105 ms
77,548 KB
testcase_21 AC 205 ms
110,780 KB
testcase_22 AC 94 ms
77,540 KB
testcase_23 AC 94 ms
76,504 KB
testcase_24 AC 113 ms
80,192 KB
testcase_25 AC 112 ms
80,908 KB
testcase_26 AC 105 ms
79,696 KB
testcase_27 AC 125 ms
84,312 KB
testcase_28 AC 171 ms
97,592 KB
testcase_29 AC 111 ms
78,996 KB
testcase_30 AC 137 ms
89,528 KB
testcase_31 AC 184 ms
103,452 KB
testcase_32 AC 245 ms
124,692 KB
testcase_33 AC 244 ms
124,592 KB
testcase_34 AC 244 ms
124,748 KB
testcase_35 AC 247 ms
124,600 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

mod = 998244353


def main():
    import sys
    input = sys.stdin.readline

    H, W = map(int, input().split())

    print("Yes")
    ans = [[0] * W for _ in range(H)]
    B = []
    for h in range(H):
        for w in range(W):
            if (h + w) & 1:
                B.append(h * W + w + 1)
            else:
                ans[h][w] = h * W + w + 1
    for h in range(H):
        for w in range(W):
            if (h + w) & 1:
                ans[h][w] = B.pop()
    for h in range(H):
        print(*ans[h])

    S = ans[0][0] + ans[0][1] + ans[1][0] + ans[1][1]
    for h in range(H - 1):
        for w in range(W - 1):
            assert ans[h][w] + ans[h+1][w] + ans[h][w+1] + ans[h+1][w+1] == S


if __name__ == '__main__':
    main()
0