結果

問題 No.2112 All 2x2 are Equal
ユーザー タコイモ
提出日時 2022-10-28 23:01:38
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 641 bytes
コンパイル時間 158 ms
コンパイル使用メモリ 82,120 KB
実行使用メモリ 93,056 KB
最終ジャッジ日時 2024-07-06 02:14:38
合計ジャッジ時間 6,897 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 23 WA * 11
権限があれば一括ダウンロードができます

ソースコード

diff #

H,W= map(int,input().split())
print('Yes')
K = [i for i in range(1,H*W+1)]
S = 1+H*W
count = 1
co = H*W
ans = [[0]*W for _ in range(H)]
ans[0][0] = 1
for i in range(H//2):
  for j in range(W):
    if j % 2 == 0:
      ans[2*i][j] = count
      ans[2*i+1][j] = co
      count += 1
      co -= 1
    else:
      ans[2*i][j] = co
      ans[2*i+1][j] = count
      count += 1
      co -= 1
  print(*ans[2*i])
  print(*ans[2*i+1])
if H % 2 == 1:
  D = ans[-2][0]+ans[-2][1]
  ans[-1][0] = count
  for j in range(1,W):
    if j % 2 == 0:
      
      ans[-1][j] = D-ans[-1][j-1] 
    else:
      ans[-1][j] = D-ans[-1][j-1]-2
  print(*ans[-1])
  
0