結果

問題 No.2218 Multiple LIS
ユーザー ShirotsumeShirotsume
提出日時 2023-02-14 07:28:44
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 822 bytes
コンパイル時間 658 ms
コンパイル使用メモリ 86,388 KB
実行使用メモリ 87,748 KB
最終ジャッジ日時 2023-09-23 17:29:42
合計ジャッジ時間 9,249 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 93 ms
71,456 KB
testcase_01 AC 92 ms
71,336 KB
testcase_02 AC 94 ms
71,416 KB
testcase_03 AC 93 ms
71,440 KB
testcase_04 AC 91 ms
71,156 KB
testcase_05 AC 94 ms
71,668 KB
testcase_06 AC 96 ms
71,484 KB
testcase_07 AC 95 ms
71,616 KB
testcase_08 AC 94 ms
71,396 KB
testcase_09 AC 95 ms
71,076 KB
testcase_10 AC 94 ms
71,480 KB
testcase_11 AC 103 ms
76,720 KB
testcase_12 AC 105 ms
76,960 KB
testcase_13 AC 117 ms
77,460 KB
testcase_14 AC 110 ms
77,728 KB
testcase_15 AC 114 ms
77,856 KB
testcase_16 AC 103 ms
76,680 KB
testcase_17 AC 114 ms
77,676 KB
testcase_18 AC 102 ms
76,880 KB
testcase_19 AC 104 ms
76,828 KB
testcase_20 AC 112 ms
77,464 KB
testcase_21 AC 855 ms
78,328 KB
testcase_22 TLE -
testcase_23 -- -
testcase_24 -- -
testcase_25 -- -
testcase_26 -- -
testcase_27 -- -
testcase_28 -- -
testcase_29 -- -
testcase_30 -- -
testcase_31 -- -
testcase_32 -- -
testcase_33 -- -
testcase_34 -- -
testcase_35 -- -
testcase_36 -- -
testcase_37 -- -
testcase_38 -- -
testcase_39 -- -
testcase_40 -- -
testcase_41 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
from collections import deque, Counter
input = lambda: sys.stdin.readline().rstrip()
ii = lambda: int(input())
mi = lambda: map(int, input().split())
li = lambda: list(mi())
inf = 2 ** 63 - 1
mod = 998244353

n = ii()

a = li()

#ふつうのLISと同様にdpすればよい?
#無理そう

#dp[i] = i番目が最後尾であるときの最大値とすると,iを見るときにはa[i]の約数の部分(最大値)だけ見ればよい

dp = [-inf] * (n + 1)
dp[0] = 1
maxi = [0] * (max(a) + 1)
for idx, v in enumerate(a):
    div = set()
    v2 = v
    for i in range(1, v2 + 1):
        if i * i > v2:
            continue
        if v2 % i == 0:
            div.add(i)
            div.add(v2 // i)
    for v2 in div:
        dp[idx] = max(dp[idx], maxi[v2] + 1)
    maxi[v] = dp[idx]

print(max(dp))
0