結果

問題 No.390 最長の数列
ユーザー konsin_tokagekonsin_tokage
提出日時 2018-04-07 00:58:06
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 331 ms / 5,000 ms
コード長 333 bytes
コンパイル時間 296 ms
コンパイル使用メモリ 87,132 KB
実行使用メモリ 101,000 KB
最終ジャッジ日時 2023-09-08 18:07:04
合計ジャッジ時間 4,193 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 96 ms
90,948 KB
testcase_01 AC 93 ms
90,800 KB
testcase_02 AC 97 ms
90,920 KB
testcase_03 AC 95 ms
90,896 KB
testcase_04 AC 98 ms
90,996 KB
testcase_05 AC 113 ms
100,260 KB
testcase_06 AC 331 ms
100,652 KB
testcase_07 AC 92 ms
90,824 KB
testcase_08 AC 91 ms
90,644 KB
testcase_09 AC 96 ms
90,816 KB
testcase_10 AC 233 ms
100,632 KB
testcase_11 AC 239 ms
101,000 KB
testcase_12 AC 224 ms
100,544 KB
testcase_13 AC 148 ms
98,516 KB
testcase_14 AC 235 ms
100,392 KB
testcase_15 AC 91 ms
90,936 KB
testcase_16 AC 91 ms
90,916 KB
testcase_17 AC 102 ms
92,332 KB
testcase_18 AC 104 ms
92,456 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n = int(input())
m = 10**6+1
s = [False]*m
for i in map(int, input().split()):
    s[i] = True
memo = [0]*m
def dfs(i):
    if not memo[i]:
        memo[i] = 1
        for j in range(i+i, m, i):
            if s[j]:
                memo[i] = max(memo[i], 1 + dfs(j))
    return memo[i]
print(max(dfs(i) for i in range(1, m) if s[i]))
0