結果

問題 No.1988 Divisor Tiling
ユーザー ikomaikoma
提出日時 2022-06-24 22:55:24
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 93 ms / 2,000 ms
コード長 556 bytes
コンパイル時間 454 ms
コンパイル使用メモリ 87,188 KB
実行使用メモリ 76,732 KB
最終ジャッジ日時 2023-08-08 13:00:57
合計ジャッジ時間 5,302 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 70 ms
71,284 KB
testcase_01 AC 71 ms
71,044 KB
testcase_02 AC 71 ms
71,228 KB
testcase_03 AC 70 ms
71,236 KB
testcase_04 AC 69 ms
71,208 KB
testcase_05 AC 70 ms
71,128 KB
testcase_06 AC 70 ms
71,232 KB
testcase_07 AC 69 ms
71,124 KB
testcase_08 AC 70 ms
71,236 KB
testcase_09 AC 71 ms
71,140 KB
testcase_10 AC 72 ms
71,060 KB
testcase_11 AC 71 ms
71,248 KB
testcase_12 AC 73 ms
71,140 KB
testcase_13 AC 72 ms
71,056 KB
testcase_14 AC 71 ms
71,172 KB
testcase_15 AC 72 ms
71,040 KB
testcase_16 AC 71 ms
71,288 KB
testcase_17 AC 72 ms
71,132 KB
testcase_18 AC 87 ms
76,500 KB
testcase_19 AC 82 ms
76,352 KB
testcase_20 AC 80 ms
76,480 KB
testcase_21 AC 81 ms
76,444 KB
testcase_22 AC 82 ms
76,288 KB
testcase_23 AC 81 ms
76,324 KB
testcase_24 AC 82 ms
76,348 KB
testcase_25 AC 82 ms
76,420 KB
testcase_26 AC 85 ms
76,372 KB
testcase_27 AC 87 ms
76,660 KB
testcase_28 AC 90 ms
76,448 KB
testcase_29 AC 93 ms
76,728 KB
testcase_30 AC 91 ms
76,732 KB
testcase_31 AC 85 ms
76,168 KB
testcase_32 AC 69 ms
70,924 KB
testcase_33 AC 70 ms
71,068 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