結果

問題 No.2218 Multiple LIS
ユーザー kohakoha11301kohakoha11301
提出日時 2023-02-27 14:35:03
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 722 ms / 3,000 ms
コード長 640 bytes
コンパイル時間 2,590 ms
コンパイル使用メモリ 86,736 KB
実行使用メモリ 92,912 KB
最終ジャッジ日時 2023-10-13 00:07:03
合計ジャッジ時間 14,201 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 75 ms
76,164 KB
testcase_01 AC 75 ms
75,640 KB
testcase_02 AC 74 ms
76,232 KB
testcase_03 AC 74 ms
75,944 KB
testcase_04 AC 74 ms
76,208 KB
testcase_05 AC 74 ms
76,344 KB
testcase_06 AC 73 ms
76,060 KB
testcase_07 AC 75 ms
76,412 KB
testcase_08 AC 74 ms
76,144 KB
testcase_09 AC 74 ms
76,204 KB
testcase_10 AC 74 ms
76,020 KB
testcase_11 AC 74 ms
76,016 KB
testcase_12 AC 81 ms
77,272 KB
testcase_13 AC 94 ms
78,028 KB
testcase_14 AC 88 ms
77,972 KB
testcase_15 AC 88 ms
77,956 KB
testcase_16 AC 76 ms
76,932 KB
testcase_17 AC 89 ms
77,904 KB
testcase_18 AC 77 ms
76,252 KB
testcase_19 AC 79 ms
76,836 KB
testcase_20 AC 92 ms
78,068 KB
testcase_21 AC 109 ms
79,032 KB
testcase_22 AC 229 ms
82,796 KB
testcase_23 AC 336 ms
86,012 KB
testcase_24 AC 138 ms
78,768 KB
testcase_25 AC 372 ms
87,388 KB
testcase_26 AC 481 ms
92,060 KB
testcase_27 AC 481 ms
92,444 KB
testcase_28 AC 485 ms
92,048 KB
testcase_29 AC 484 ms
92,320 KB
testcase_30 AC 484 ms
92,048 KB
testcase_31 AC 243 ms
91,708 KB
testcase_32 AC 274 ms
91,788 KB
testcase_33 AC 238 ms
92,136 KB
testcase_34 AC 237 ms
91,616 KB
testcase_35 AC 270 ms
91,888 KB
testcase_36 AC 120 ms
90,764 KB
testcase_37 AC 697 ms
92,584 KB
testcase_38 AC 76 ms
76,496 KB
testcase_39 AC 76 ms
76,352 KB
testcase_40 AC 722 ms
92,912 KB
testcase_41 AC 720 ms
92,844 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

def divisor(n):
    sq = n ** 0.5
    border = int(sq)
    table = []
    bigs = []
    for small in range(1, border + 1):
        if n % small == 0:
            table.append(small)
            big = n // small
            bigs.append(big)
    if border == sq:  # nが平方数
        bigs.pop()
    table += reversed(bigs)
    return table


n = int(input())
a = list(map(int, input().split()))
dp = [0] * (10 ** 5 + 1)
dp[1] = 1
for i in range(n):
    tmp = divisor(a[i])
    cnt = -1
    v = -1
    for j in tmp:
        if dp[j] > v:
            cnt = j
            v = dp[j]
    dp[a[i]] = max(dp[a[i]], dp[cnt] + 1)
print(max(dp)-1)
0