結果

問題 No.2112 All 2x2 are Equal
ユーザー ShirotsumeShirotsume
提出日時 2022-10-28 22:01:07
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 304 ms / 2,000 ms
コード長 685 bytes
コンパイル時間 445 ms
コンパイル使用メモリ 87,056 KB
実行使用メモリ 103,160 KB
最終ジャッジ日時 2023-09-20 04:59:16
合計ジャッジ時間 12,035 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 96 ms
71,588 KB
testcase_01 AC 96 ms
71,664 KB
testcase_02 AC 123 ms
78,420 KB
testcase_03 AC 119 ms
78,208 KB
testcase_04 AC 185 ms
81,328 KB
testcase_05 AC 206 ms
82,676 KB
testcase_06 AC 289 ms
103,160 KB
testcase_07 AC 165 ms
80,544 KB
testcase_08 AC 251 ms
102,544 KB
testcase_09 AC 127 ms
78,712 KB
testcase_10 AC 174 ms
80,388 KB
testcase_11 AC 154 ms
80,028 KB
testcase_12 AC 163 ms
80,248 KB
testcase_13 AC 264 ms
102,852 KB
testcase_14 AC 124 ms
78,752 KB
testcase_15 AC 224 ms
92,536 KB
testcase_16 AC 110 ms
77,472 KB
testcase_17 AC 251 ms
102,420 KB
testcase_18 AC 120 ms
78,392 KB
testcase_19 AC 133 ms
78,792 KB
testcase_20 AC 126 ms
78,540 KB
testcase_21 AC 257 ms
101,684 KB
testcase_22 AC 123 ms
78,608 KB
testcase_23 AC 122 ms
78,524 KB
testcase_24 AC 136 ms
78,784 KB
testcase_25 AC 140 ms
79,244 KB
testcase_26 AC 134 ms
78,988 KB
testcase_27 AC 146 ms
79,232 KB
testcase_28 AC 190 ms
81,524 KB
testcase_29 AC 136 ms
78,620 KB
testcase_30 AC 171 ms
80,344 KB
testcase_31 AC 205 ms
82,968 KB
testcase_32 AC 299 ms
102,836 KB
testcase_33 AC 304 ms
103,076 KB
testcase_34 AC 302 ms
103,016 KB
testcase_35 AC 304 ms
103,156 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from collections import deque
import sys
input = lambda: sys.stdin.readline().rstrip()
ii = lambda: int(input())
mi = lambda: map(int, input().split())
li = lambda: list(mi())
inf = 2 ** 63 - 1
mod = 998244353

h, w = mi()

ans = [[0] * w for _ in range(h)]

s = deque(range(1, h * w + 1))

for i in range(h):
    for j in range(w):
        if (i + j) % 2:
            ans[i][j] = s.popleft()
        else:
            ans[i][j] = s.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])
        if len(s) >= 2:
            print('No')
            exit()
print('Yes')

for v in ans:
    print(*v)
0