結果

問題 No.1988 Divisor Tiling
ユーザー ikoma
提出日時 2022-06-24 22:49:04
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 409 bytes
コンパイル時間 199 ms
コンパイル使用メモリ 82,176 KB
実行使用メモリ 63,744 KB
最終ジャッジ日時 2024-11-08 18:37:34
合計ジャッジ時間 5,832 ms
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 15 WA * 17
権限があれば一括ダウンロードができます

ソースコード

diff #

N,H=map(int,input().split())

if N%H!=0:print(-1);exit()

p = {6:3, 28:7, 496:31, 8128:127}

p = p[N]

if (N//p)%H != 0:print(-1);exit()
W=N//H
ans = [[0]*W for _ in range(H)]

def solve(a):
    ret = []
    for i in range(1,a//2+1):
        if a%i==0:
            ret.append(i)
    return ret

i=0
for x in solve(N):
    for j in range(x):
        ans[i//W][i%W] = x
        i+=1

for a in ans:
    print(*a)
0