結果
| 問題 |
No.2112 All 2x2 are Equal
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2022-10-28 22:43:27 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
AC
|
| 実行時間 | 169 ms / 2,000 ms |
| コード長 | 573 bytes |
| コンパイル時間 | 259 ms |
| コンパイル使用メモリ | 82,432 KB |
| 実行使用メモリ | 85,316 KB |
| 最終ジャッジ日時 | 2024-07-06 01:56:45 |
| 合計ジャッジ時間 | 7,631 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 34 |
ソースコード
h,w = map(int,input().split())
ans = [[0]*(w) for i in range(h)]
now = 1
for i in range(h):
for j in range(w):
if i % 2 == j % 2:
ans[i][j] = now
now += 1
for i in range(h)[::-1]:
for j in range(w)[::-1]:
tmp = i*w+j
if i%2 != j% 2:
ans[i][j] = now
now += 1
flg = True
s = ans[0][0] + ans[0][1] + ans[1][0] + ans[1][1]
for i in range(h-1):
for j in range(w-1):
if ans[i][j] +ans[i+1][j] +ans[i][j+1] +ans[i+1][j+1] == s: continue
flg = False
if flg:
print('Yes')
for i in ans:
print(*i)
else:
print('No')