結果

問題 No.1988 Divisor Tiling
ユーザー ikomaikoma
提出日時 2022-06-24 22:55:24
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 72 ms / 2,000 ms
コード長 556 bytes
コンパイル時間 163 ms
コンパイル使用メモリ 82,432 KB
実行使用メモリ 71,552 KB
最終ジャッジ日時 2024-04-26 05:50:55
合計ジャッジ時間 3,352 ms
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 42 ms
51,968 KB
testcase_01 AC 41 ms
51,840 KB
testcase_02 AC 40 ms
52,224 KB
testcase_03 AC 40 ms
51,968 KB
testcase_04 AC 40 ms
51,840 KB
testcase_05 AC 41 ms
52,096 KB
testcase_06 AC 40 ms
52,224 KB
testcase_07 AC 40 ms
52,224 KB
testcase_08 AC 41 ms
52,864 KB
testcase_09 AC 41 ms
52,736 KB
testcase_10 AC 41 ms
52,736 KB
testcase_11 AC 41 ms
52,736 KB
testcase_12 AC 41 ms
52,480 KB
testcase_13 AC 41 ms
52,736 KB
testcase_14 AC 41 ms
53,376 KB
testcase_15 AC 42 ms
52,608 KB
testcase_16 AC 42 ms
53,120 KB
testcase_17 AC 42 ms
52,992 KB
testcase_18 AC 54 ms
63,360 KB
testcase_19 AC 54 ms
63,488 KB
testcase_20 AC 54 ms
63,744 KB
testcase_21 AC 56 ms
63,360 KB
testcase_22 AC 55 ms
63,744 KB
testcase_23 AC 54 ms
63,616 KB
testcase_24 AC 54 ms
63,872 KB
testcase_25 AC 55 ms
63,744 KB
testcase_26 AC 58 ms
64,768 KB
testcase_27 AC 63 ms
67,072 KB
testcase_28 AC 65 ms
67,712 KB
testcase_29 AC 72 ms
71,168 KB
testcase_30 AC 70 ms
71,552 KB
testcase_31 AC 59 ms
65,920 KB
testcase_32 AC 40 ms
52,224 KB
testcase_33 AC 40 ms
51,840 KB
権限があれば一括ダウンロードができます

ソースコード

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 and H%p!=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
if (N//p)%H==0:
    for x in solve(N):
        for j in range(x):
            ans[i//W][i%W] = x
            i+=1
else:
    for x in solve(N):
        for j in range(x):
            ans[i%H][i//H] = x
            i+=1
for a in ans:
    print(*a)
0