結果

問題 No.390 最長の数列
ユーザー rlangevinrlangevin
提出日時 2023-02-04 01:59:24
言語 PyPy3
(7.3.15)
結果
RE  
実行時間 -
コード長 461 bytes
コンパイル時間 600 ms
コンパイル使用メモリ 87,072 KB
実行使用メモリ 118,380 KB
最終ジャッジ日時 2023-09-15 22:36:43
合計ジャッジ時間 8,303 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 244 ms
92,576 KB
testcase_01 AC 255 ms
92,284 KB
testcase_02 AC 253 ms
92,572 KB
testcase_03 AC 243 ms
92,536 KB
testcase_04 AC 249 ms
92,228 KB
testcase_05 RE -
testcase_06 RE -
testcase_07 AC 260 ms
92,488 KB
testcase_08 RE -
testcase_09 RE -
testcase_10 RE -
testcase_11 RE -
testcase_12 RE -
testcase_13 RE -
testcase_14 AC 388 ms
118,380 KB
testcase_15 AC 265 ms
92,532 KB
testcase_16 RE -
testcase_17 RE -
testcase_18 RE -
権限があれば一括ダウンロードができます

ソースコード

diff #

from collections import *

def enum_div(M):
    L = [[1] for i in range(M + 1)]
    for i in range(2, M + 1):
        for j in range(i, M + 1, i):
            L[j].append(i)
    return L


N = int(input())
X = list(map(int, input().split()))
X.sort()
L = enum_div(100005)
D = defaultdict(int)
for i in range(N):
    val = 0
    for v in L[X[i]]:
        val = max(val, D[v])
    D[X[i]] = val + 1

ans = 0
for k, v in D.items():
    ans = max(ans, v)
print(ans)
0