結果

問題 No.1988 Divisor Tiling
ユーザー lloyzlloyz
提出日時 2022-06-26 13:16:27
言語 PyPy3
(7.3.13)
結果
AC  
実行時間 101 ms / 2,000 ms
コード長 545 bytes
コンパイル時間 1,600 ms
コンパイル使用メモリ 87,008 KB
実行使用メモリ 77,700 KB
最終ジャッジ日時 2023-08-10 12:18:41
合計ジャッジ時間 5,704 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 66 ms
71,232 KB
testcase_01 AC 67 ms
71,332 KB
testcase_02 AC 68 ms
71,284 KB
testcase_03 AC 68 ms
71,336 KB
testcase_04 AC 68 ms
71,340 KB
testcase_05 AC 67 ms
71,200 KB
testcase_06 AC 67 ms
71,196 KB
testcase_07 AC 67 ms
70,932 KB
testcase_08 AC 68 ms
71,240 KB
testcase_09 AC 70 ms
71,192 KB
testcase_10 AC 71 ms
71,204 KB
testcase_11 AC 69 ms
71,244 KB
testcase_12 AC 73 ms
71,068 KB
testcase_13 AC 72 ms
71,132 KB
testcase_14 AC 71 ms
71,264 KB
testcase_15 AC 69 ms
71,272 KB
testcase_16 AC 71 ms
71,328 KB
testcase_17 AC 71 ms
71,440 KB
testcase_18 AC 79 ms
76,476 KB
testcase_19 AC 79 ms
76,360 KB
testcase_20 AC 78 ms
76,436 KB
testcase_21 AC 80 ms
76,404 KB
testcase_22 AC 79 ms
76,440 KB
testcase_23 AC 81 ms
76,396 KB
testcase_24 AC 80 ms
76,432 KB
testcase_25 AC 79 ms
76,428 KB
testcase_26 AC 81 ms
76,456 KB
testcase_27 AC 87 ms
76,408 KB
testcase_28 AC 90 ms
76,368 KB
testcase_29 AC 101 ms
77,700 KB
testcase_30 AC 96 ms
77,596 KB
testcase_31 AC 87 ms
76,840 KB
testcase_32 AC 69 ms
71,244 KB
testcase_33 AC 70 ms
71,244 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n, h = map(int, input().split())

P = {6: 3, 28: 7, 496: 31, 8128: 127}
p = P[n]
w = n // h

R = [1]
f = 2
while f * f <= n:
    if n % f == 0:
        R.append(f)
        if n // f != f:
            R.append(n // f)
    f += 1
R.sort()
ANS = [[0 for _ in range(w)] for _ in range(h)]
i = 0
if (n // p) % h == 0:
    for x in R:
        for j in range(x):
            ANS[i // w][i % w] = x
            i += 1
else:
    for x in R:
        for j in range(x):
            ANS[i % h][i // h] = x
            i += 1
for ans in ANS:
    print(*ans)
0