結果

問題 No.1974 2x2 Flipper
ユーザー とりゐとりゐ
提出日時 2022-06-10 22:19:41
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 571 bytes
コンパイル時間 220 ms
コンパイル使用メモリ 81,716 KB
実行使用メモリ 85,692 KB
最終ジャッジ日時 2023-10-21 05:21:35
合計ジャッジ時間 5,627 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 40 ms
53,428 KB
testcase_01 AC 64 ms
75,332 KB
testcase_02 AC 49 ms
63,940 KB
testcase_03 AC 113 ms
76,496 KB
testcase_04 AC 83 ms
75,768 KB
testcase_05 WA -
testcase_06 AC 98 ms
75,876 KB
testcase_07 AC 83 ms
75,716 KB
testcase_08 AC 61 ms
75,316 KB
testcase_09 AC 97 ms
76,216 KB
testcase_10 WA -
testcase_11 AC 87 ms
76,060 KB
testcase_12 AC 113 ms
76,808 KB
testcase_13 AC 95 ms
76,020 KB
testcase_14 AC 77 ms
75,580 KB
testcase_15 AC 120 ms
76,672 KB
testcase_16 WA -
testcase_17 AC 101 ms
76,216 KB
testcase_18 AC 55 ms
72,424 KB
testcase_19 AC 62 ms
75,364 KB
testcase_20 AC 79 ms
75,824 KB
testcase_21 AC 137 ms
77,416 KB
testcase_22 AC 138 ms
77,276 KB
testcase_23 AC 143 ms
77,488 KB
testcase_24 WA -
testcase_25 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

h,w=map(int,input().split())
if min(h,w)==0:
  print(0)
  for i in range(h):
    print(*[0]*w)
  exit()

if h%2==0 and w%2==0:
  print(h*w)
  for i in range(h):
    print(*[1]*w)
  exit()

if h%2==0:
  print(h*(w-1))
  for i in range(h):
    print(*[1]*(w-1)+[0])
  exit()

if w%2==0:
  print((h-1)*w)
  for i in range(h-1):
    print(*[1]*w)
  print(*[0]*w)
  exit()

ans=[[0]*w for i in range(h)]
for i in range(h-1):
  for j in range(w-1):
    ans[i][j]=1

ans[h-2][w-2]=0
ans[h-2][w-1]=1
ans[h-1][w-2]=1
ans[h-1][w-1]=1

print((h-1)*(w-1)+2)
for i in ans:
  print(*i)
0