結果

問題 No.390 最長の数列
ユーザー roarisroaris
提出日時 2019-08-14 23:20:46
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 798 ms / 5,000 ms
コード長 375 bytes
コンパイル時間 820 ms
コンパイル使用メモリ 81,668 KB
実行使用メモリ 246,048 KB
最終ジャッジ日時 2023-10-19 18:20:04
合計ジャッジ時間 4,789 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 41 ms
53,520 KB
testcase_01 AC 42 ms
55,572 KB
testcase_02 AC 42 ms
55,572 KB
testcase_03 AC 41 ms
53,524 KB
testcase_04 AC 42 ms
55,572 KB
testcase_05 AC 121 ms
107,396 KB
testcase_06 AC 798 ms
246,048 KB
testcase_07 AC 42 ms
53,528 KB
testcase_08 AC 48 ms
66,924 KB
testcase_09 AC 198 ms
237,000 KB
testcase_10 AC 266 ms
179,904 KB
testcase_11 AC 278 ms
189,204 KB
testcase_12 AC 278 ms
189,204 KB
testcase_13 AC 340 ms
240,312 KB
testcase_14 AC 134 ms
102,476 KB
testcase_15 AC 44 ms
59,256 KB
testcase_16 AC 49 ms
66,872 KB
testcase_17 AC 68 ms
78,364 KB
testcase_18 AC 78 ms
83,448 KB
権限があれば一括ダウンロードができます

ソースコード

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:
    mult = 2
    
    while mult * xi <= A:
        if flag[mult*xi]:
            dp[mult*xi] = max(dp[mult*xi], dp[xi]+1)
        mult += 1
        
print(max(dp))
0