結果

問題 No.1974 2x2 Flipper
ユーザー hir355hir355
提出日時 2022-06-10 22:32:34
言語 PyPy3
(7.3.13)
結果
AC  
実行時間 131 ms / 2,000 ms
コード長 653 bytes
コンパイル時間 879 ms
コンパイル使用メモリ 81,612 KB
実行使用メモリ 85,648 KB
最終ジャッジ日時 2023-10-21 05:59:29
合計ジャッジ時間 5,437 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 36 ms
53,524 KB
testcase_01 AC 62 ms
76,628 KB
testcase_02 AC 44 ms
64,416 KB
testcase_03 AC 103 ms
82,164 KB
testcase_04 AC 74 ms
78,476 KB
testcase_05 AC 65 ms
77,012 KB
testcase_06 AC 90 ms
80,004 KB
testcase_07 AC 82 ms
78,640 KB
testcase_08 AC 52 ms
74,344 KB
testcase_09 AC 90 ms
80,388 KB
testcase_10 AC 50 ms
72,752 KB
testcase_11 AC 80 ms
79,064 KB
testcase_12 AC 101 ms
82,128 KB
testcase_13 AC 83 ms
79,420 KB
testcase_14 AC 69 ms
77,800 KB
testcase_15 AC 116 ms
83,224 KB
testcase_16 AC 50 ms
73,948 KB
testcase_17 AC 98 ms
80,984 KB
testcase_18 AC 49 ms
73,344 KB
testcase_19 AC 59 ms
76,276 KB
testcase_20 AC 76 ms
78,376 KB
testcase_21 AC 128 ms
85,648 KB
testcase_22 AC 128 ms
85,644 KB
testcase_23 AC 131 ms
85,536 KB
testcase_24 AC 122 ms
85,452 KB
testcase_25 AC 35 ms
53,524 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n, m = map(int, input().split())
if n == 1 or m == 1:
    ans = [[0] * m for _ in range(n)]
    print(0)
    for row in ans:
        print(*row)
    exit(0)
if n % 2 == 1 and m % 2 == 1:
    print(n * m - max(n, m))
    ans = [[1] * m for _ in range(n)]
    for i in range(min(n, m)):
        ans[i][i] = 0
    for i in range(min(n, m), n):
        ans[i][0] = 0
    for i in range(min(n, m), m):
        ans[0][i] = 0
    for row in ans:
        print(*row)
    exit(0)
x = n // 2 * 2
y = m // 2 * 2
ans = [[0] * m for _ in range(n)]
for i in range(x):
    for j in range(y):
        ans[i][j] = 1
else:
    print(x * y)
for row in ans:
    print(*row)
0