結果

問題 No.1988 Divisor Tiling
ユーザー 👑 rin204rin204
提出日時 2022-06-24 21:33:22
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 76 ms / 2,000 ms
コード長 928 bytes
コンパイル時間 205 ms
コンパイル使用メモリ 82,352 KB
実行使用メモリ 77,088 KB
最終ジャッジ日時 2024-04-26 04:47:37
合計ジャッジ時間 3,157 ms
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 39 ms
53,020 KB
testcase_01 AC 36 ms
53,432 KB
testcase_02 AC 40 ms
53,620 KB
testcase_03 AC 38 ms
53,484 KB
testcase_04 AC 38 ms
53,448 KB
testcase_05 AC 37 ms
53,404 KB
testcase_06 AC 38 ms
52,668 KB
testcase_07 AC 37 ms
53,072 KB
testcase_08 AC 39 ms
53,476 KB
testcase_09 AC 39 ms
53,552 KB
testcase_10 AC 40 ms
54,728 KB
testcase_11 AC 40 ms
53,700 KB
testcase_12 AC 39 ms
53,704 KB
testcase_13 AC 39 ms
53,512 KB
testcase_14 AC 40 ms
53,504 KB
testcase_15 AC 39 ms
54,284 KB
testcase_16 AC 39 ms
55,196 KB
testcase_17 AC 42 ms
53,956 KB
testcase_18 AC 50 ms
63,472 KB
testcase_19 AC 48 ms
64,440 KB
testcase_20 AC 51 ms
64,792 KB
testcase_21 AC 49 ms
64,784 KB
testcase_22 AC 49 ms
64,252 KB
testcase_23 AC 49 ms
64,636 KB
testcase_24 AC 50 ms
64,000 KB
testcase_25 AC 51 ms
66,040 KB
testcase_26 AC 53 ms
67,912 KB
testcase_27 AC 58 ms
69,052 KB
testcase_28 AC 62 ms
71,040 KB
testcase_29 AC 76 ms
77,088 KB
testcase_30 AC 68 ms
76,812 KB
testcase_31 AC 58 ms
72,712 KB
testcase_32 AC 38 ms
53,660 KB
testcase_33 AC 38 ms
53,016 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n, h = map(int, input().split())

if n == 6:
    div = []
    for i in range(2):
        div.append(1 << i)
        div.append(3 << i)
elif n == 28:
    div = []
    for i in range(3):
        div.append(1 << i)
        div.append(7 << i)
elif n == 496:
    div = []
    for i in range(5):
        div.append(1 << i)
        div.append(31 << i)
else:
    div = []
    for i in range(7):
        div.append(1 << i)
        div.append(127 << i)

div.sort()
div.pop()
w = n // h
if h > w:
    h, w = w, h
    rev = True
else:
    rev = False

A = [[0] * w for _ in range(h)]
i = 0

while div[-1] >= w:
    x = div.pop()
    d = x // w
    for _ in range(d):
        for j in range(w):
            A[i][j] = x
        i += 1
j = 0
i = h - 1
while div:
    x = div.pop()
    for _ in range(x):
        A[i][j] = x
        j += 1
if rev:
    B = [[A[j][i] for j in range(h)] for i in range(w)]
    A = B
for row in A:
    print(*row)
0