結果

問題 No.1988 Divisor Tiling
ユーザー 👑 rin204rin204
提出日時 2022-06-24 21:33:22
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 99 ms / 2,000 ms
コード長 928 bytes
コンパイル時間 357 ms
コンパイル使用メモリ 87,164 KB
実行使用メモリ 77,992 KB
最終ジャッジ日時 2023-08-08 11:48:58
合計ジャッジ時間 4,923 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 65 ms
71,048 KB
testcase_01 AC 66 ms
71,044 KB
testcase_02 AC 64 ms
70,952 KB
testcase_03 AC 64 ms
71,000 KB
testcase_04 AC 66 ms
70,840 KB
testcase_05 AC 67 ms
70,840 KB
testcase_06 AC 65 ms
71,168 KB
testcase_07 AC 68 ms
71,220 KB
testcase_08 AC 67 ms
71,328 KB
testcase_09 AC 68 ms
71,340 KB
testcase_10 AC 66 ms
70,836 KB
testcase_11 AC 67 ms
71,184 KB
testcase_12 AC 67 ms
70,988 KB
testcase_13 AC 68 ms
71,052 KB
testcase_14 AC 67 ms
71,328 KB
testcase_15 AC 73 ms
71,328 KB
testcase_16 AC 67 ms
70,816 KB
testcase_17 AC 68 ms
70,836 KB
testcase_18 AC 76 ms
76,316 KB
testcase_19 AC 77 ms
75,928 KB
testcase_20 AC 81 ms
76,212 KB
testcase_21 AC 79 ms
76,172 KB
testcase_22 AC 77 ms
76,344 KB
testcase_23 AC 79 ms
76,048 KB
testcase_24 AC 78 ms
76,404 KB
testcase_25 AC 77 ms
76,432 KB
testcase_26 AC 82 ms
76,516 KB
testcase_27 AC 84 ms
76,476 KB
testcase_28 AC 87 ms
76,344 KB
testcase_29 AC 99 ms
77,992 KB
testcase_30 AC 96 ms
77,572 KB
testcase_31 AC 87 ms
76,612 KB
testcase_32 AC 68 ms
70,956 KB
testcase_33 AC 67 ms
71,228 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