結果

問題 No.390 最長の数列
ユーザー maninimanini
提出日時 2021-01-25 22:05:04
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 1,765 ms / 5,000 ms
コード長 627 bytes
コンパイル時間 391 ms
コンパイル使用メモリ 87,352 KB
実行使用メモリ 92,452 KB
最終ジャッジ日時 2023-09-04 21:11:07
合計ジャッジ時間 11,590 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 72 ms
71,948 KB
testcase_01 AC 72 ms
71,880 KB
testcase_02 AC 72 ms
71,784 KB
testcase_03 AC 71 ms
71,780 KB
testcase_04 AC 70 ms
72,032 KB
testcase_05 AC 1,765 ms
92,176 KB
testcase_06 AC 1,318 ms
92,428 KB
testcase_07 AC 71 ms
71,388 KB
testcase_08 AC 71 ms
71,516 KB
testcase_09 AC 71 ms
72,020 KB
testcase_10 AC 1,324 ms
92,216 KB
testcase_11 AC 1,298 ms
92,116 KB
testcase_12 AC 1,323 ms
92,452 KB
testcase_13 AC 928 ms
88,296 KB
testcase_14 AC 660 ms
92,144 KB
testcase_15 AC 72 ms
71,920 KB
testcase_16 AC 78 ms
76,148 KB
testcase_17 AC 137 ms
77,432 KB
testcase_18 AC 176 ms
77,948 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

# coding:UTF-8
import sys

MOD = 10 ** 9 + 7
INF = float('inf')

N = int(input())    # 数字
X = list(map(int, input().split()))     # スペース区切り連続数字
X.sort()

mp = {}

# 約数列挙
def divisorList(a):
    l = []
    for i in range(1, int(a**0.5)+1):
        if a % i == 0:
            l.append(i)
            ii = a // i
            if i != ii:
                l.append(ii)
    return sorted(l)

res = 0
for x in X:
    d = divisorList(x)
    t = 0
    for n in d:
        if n in mp and mp[n] > t:
            t = mp[n]
    mp[x] = t + 1
    if mp[x] > res:
        res = mp[x]

print("{}".format(res))
0