結果

問題 No.1974 2x2 Flipper
ユーザー ニックネームニックネーム
提出日時 2022-06-10 22:49:06
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 423 ms / 2,000 ms
コード長 379 bytes
コンパイル時間 514 ms
コンパイル使用メモリ 11,772 KB
実行使用メモリ 18,416 KB
最終ジャッジ日時 2023-10-21 06:00:13
合計ジャッジ時間 7,496 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 28 ms
10,180 KB
testcase_01 AC 72 ms
11,312 KB
testcase_02 AC 31 ms
10,552 KB
testcase_03 AC 292 ms
15,708 KB
testcase_04 AC 149 ms
12,824 KB
testcase_05 AC 96 ms
11,840 KB
testcase_06 AC 210 ms
14,164 KB
testcase_07 AC 147 ms
12,636 KB
testcase_08 AC 50 ms
10,908 KB
testcase_09 AC 215 ms
14,220 KB
testcase_10 AC 48 ms
10,908 KB
testcase_11 AC 176 ms
13,424 KB
testcase_12 AC 283 ms
15,540 KB
testcase_13 AC 185 ms
13,600 KB
testcase_14 AC 121 ms
12,108 KB
testcase_15 AC 321 ms
16,556 KB
testcase_16 AC 47 ms
10,936 KB
testcase_17 AC 233 ms
14,788 KB
testcase_18 AC 49 ms
10,940 KB
testcase_19 AC 51 ms
11,004 KB
testcase_20 AC 137 ms
12,772 KB
testcase_21 AC 417 ms
18,412 KB
testcase_22 AC 414 ms
18,416 KB
testcase_23 AC 423 ms
18,408 KB
testcase_24 AC 416 ms
18,400 KB
testcase_25 AC 27 ms
10,180 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

h, w = map(int, input().split())
a = [[1]*w for _ in range(h)]
if h*w%2:
    ans = h*w-max(h, w)
    for i in range(h): a[i][min(max(h, w)-i, w)-1] = 0
    for j in range(w): a[min(max(h, w)-j, h)-1][j] = 0
else:
    ans = (h//2*2)*(w//2*2)
    if w%2:
        for i in range(h): a[i][w-1] = 0
    if h%2:
        for j in range(w): a[h-1][j] = 0
print(ans)
for s in a: print(*s)
0