結果

問題 No.2112 All 2x2 are Equal
ユーザー flygonflygon
提出日時 2022-10-28 22:39:03
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 589 bytes
コンパイル時間 1,309 ms
コンパイル使用メモリ 87,120 KB
実行使用メモリ 86,444 KB
最終ジャッジ日時 2023-09-20 05:46:11
合計ジャッジ時間 8,798 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 75 ms
71,364 KB
testcase_01 AC 73 ms
71,336 KB
testcase_02 AC 96 ms
76,660 KB
testcase_03 AC 93 ms
76,296 KB
testcase_04 WA -
testcase_05 AC 167 ms
81,728 KB
testcase_06 WA -
testcase_07 AC 137 ms
79,828 KB
testcase_08 AC 196 ms
84,028 KB
testcase_09 WA -
testcase_10 AC 144 ms
80,008 KB
testcase_11 AC 127 ms
79,368 KB
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 AC 88 ms
76,676 KB
testcase_17 AC 196 ms
84,280 KB
testcase_18 WA -
testcase_19 AC 107 ms
77,808 KB
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 WA -
testcase_24 AC 112 ms
78,288 KB
testcase_25 AC 116 ms
78,352 KB
testcase_26 WA -
testcase_27 WA -
testcase_28 WA -
testcase_29 AC 113 ms
77,948 KB
testcase_30 AC 137 ms
79,692 KB
testcase_31 AC 178 ms
82,388 KB
testcase_32 WA -
testcase_33 AC 227 ms
86,444 KB
testcase_34 WA -
testcase_35 AC 226 ms
86,140 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):
    tmp = i*w+j
    if tmp % 2 == 0:
      ans[i][j] = now
      now += 1
  
for i in range(h)[::-1]:
  for j in range(w)[::-1]:
    tmp = i*w+j
    if tmp % 2 == 1:
      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