結果

問題 No.2112 All 2x2 are Equal
ユーザー flygonflygon
提出日時 2022-10-28 22:43:27
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 225 ms / 2,000 ms
コード長 573 bytes
コンパイル時間 908 ms
コンパイル使用メモリ 86,768 KB
実行使用メモリ 86,300 KB
最終ジャッジ日時 2023-09-20 05:52:20
合計ジャッジ時間 10,648 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 75 ms
71,172 KB
testcase_01 AC 74 ms
71,056 KB
testcase_02 AC 98 ms
76,620 KB
testcase_03 AC 95 ms
76,672 KB
testcase_04 AC 155 ms
80,828 KB
testcase_05 AC 168 ms
82,028 KB
testcase_06 AC 218 ms
85,864 KB
testcase_07 AC 137 ms
79,940 KB
testcase_08 AC 193 ms
84,460 KB
testcase_09 AC 98 ms
77,488 KB
testcase_10 AC 145 ms
80,324 KB
testcase_11 AC 126 ms
79,516 KB
testcase_12 AC 135 ms
79,748 KB
testcase_13 AC 200 ms
85,492 KB
testcase_14 AC 99 ms
77,528 KB
testcase_15 AC 174 ms
82,660 KB
testcase_16 AC 87 ms
76,676 KB
testcase_17 AC 195 ms
84,380 KB
testcase_18 AC 96 ms
76,792 KB
testcase_19 AC 106 ms
77,760 KB
testcase_20 AC 103 ms
77,736 KB
testcase_21 AC 189 ms
83,896 KB
testcase_22 AC 99 ms
77,568 KB
testcase_23 AC 94 ms
76,724 KB
testcase_24 AC 113 ms
77,844 KB
testcase_25 AC 112 ms
78,220 KB
testcase_26 AC 105 ms
77,836 KB
testcase_27 AC 125 ms
78,932 KB
testcase_28 AC 157 ms
81,508 KB
testcase_29 AC 113 ms
77,976 KB
testcase_30 AC 136 ms
79,856 KB
testcase_31 AC 174 ms
82,084 KB
testcase_32 AC 222 ms
86,300 KB
testcase_33 AC 225 ms
86,200 KB
testcase_34 AC 220 ms
86,120 KB
testcase_35 AC 224 ms
86,264 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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') 
0