結果

問題 No.1988 Divisor Tiling
ユーザー 👑 H20H20
提出日時 2022-06-24 23:11:21
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 977 bytes
コンパイル時間 430 ms
コンパイル使用メモリ 82,432 KB
実行使用メモリ 70,144 KB
最終ジャッジ日時 2024-04-26 06:00:17
合計ジャッジ時間 4,747 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 37 ms
52,224 KB
testcase_01 AC 39 ms
52,352 KB
testcase_02 AC 40 ms
52,096 KB
testcase_03 AC 37 ms
52,096 KB
testcase_04 AC 38 ms
52,096 KB
testcase_05 AC 38 ms
51,968 KB
testcase_06 AC 38 ms
51,968 KB
testcase_07 AC 38 ms
52,608 KB
testcase_08 AC 41 ms
52,992 KB
testcase_09 AC 39 ms
52,864 KB
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 AC 41 ms
53,376 KB
testcase_17 AC 40 ms
52,864 KB
testcase_18 AC 48 ms
62,464 KB
testcase_19 AC 48 ms
62,464 KB
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 WA -
testcase_24 WA -
testcase_25 WA -
testcase_26 WA -
testcase_27 WA -
testcase_28 WA -
testcase_29 WA -
testcase_30 AC 57 ms
70,144 KB
testcase_31 AC 50 ms
63,232 KB
testcase_32 AC 39 ms
51,968 KB
testcase_33 AC 39 ms
52,480 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

def make_divisors(n):
    lower_divisors , upper_divisors = [], []
    i = 1
    while i*i <= n:
        if n % i == 0:
            lower_divisors.append(i)
            if i != n // i and i!=1:
                upper_divisors.append(n//i)
        i += 1
    return lower_divisors + upper_divisors[::-1]

N,H = map(int, input().split())
D = make_divisors(N)
L = []
for d in D:
    L.extend([d]*d)
if H==1:
    print(*L)
    exit()
if H==N:
    for l in L:
        print(l)
    exit()
if H==2:
    print(*L[:N//2])
    print(*L[N//2:])
    exit()
if N/H==2.0:
    for i in range(N//2):
        print(L[i],L[N-1-i])
    exit()
if N==28 and H==4:
    print('1 2 2 4 4 4 4')
    print('7 7 7 7 7 7 7')
    print('14 14 14 14 14 14 14')
    print('14 14 14 14 14 14 14')
    exit()

if N==28 and H==7:
    print('1 7 14 14')
    print('2 7 14 14')
    print('2 7 14 14')
    print('4 7 14 14')
    print('4 7 14 14')
    print('4 7 14 14')
    print('4 7 14 14')
    exit()

print(-1)
0