結果

問題 No.390 最長の数列
ユーザー roarisroaris
提出日時 2019-08-14 23:13:21
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 351 bytes
コンパイル時間 269 ms
コンパイル使用メモリ 81,648 KB
実行使用メモリ 115,836 KB
最終ジャッジ日時 2023-10-19 18:17:24
合計ジャッジ時間 7,398 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 42 ms
53,472 KB
testcase_01 AC 41 ms
53,472 KB
testcase_02 AC 41 ms
53,472 KB
testcase_03 AC 41 ms
53,472 KB
testcase_04 AC 41 ms
53,472 KB
testcase_05 TLE -
testcase_06 -- -
testcase_07 -- -
testcase_08 -- -
testcase_09 -- -
testcase_10 -- -
testcase_11 -- -
testcase_12 -- -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

#貰うDP
from collections import defaultdict

N = int(input())
x = list(map(int, input().split()))
x.sort()
flag = defaultdict(int)

for xi in x:
    flag[xi] = 1
    
A = max(x)
dp = [1] * (A+1)

for xi in x:
    for i in range(2, xi+1):
        if xi % i == 0 and flag[xi//i]:
            dp[xi] = max(dp[xi], dp[xi//i]+1)

ans = max(dp)
print(ans)
0