結果

問題 No.390 最長の数列
ユーザー ayaoniayaoni
提出日時 2020-11-27 14:12:20
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 337 ms / 5,000 ms
コード長 363 bytes
コンパイル時間 327 ms
コンパイル使用メモリ 87,112 KB
実行使用メモリ 107,188 KB
最終ジャッジ日時 2023-10-01 04:11:02
合計ジャッジ時間 4,434 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 91 ms
91,548 KB
testcase_01 AC 87 ms
91,460 KB
testcase_02 AC 94 ms
91,184 KB
testcase_03 AC 89 ms
91,412 KB
testcase_04 AC 94 ms
91,400 KB
testcase_05 AC 125 ms
106,452 KB
testcase_06 AC 337 ms
106,432 KB
testcase_07 AC 87 ms
91,360 KB
testcase_08 AC 85 ms
90,552 KB
testcase_09 AC 88 ms
91,336 KB
testcase_10 AC 156 ms
106,964 KB
testcase_11 AC 150 ms
107,016 KB
testcase_12 AC 151 ms
107,188 KB
testcase_13 AC 117 ms
102,720 KB
testcase_14 AC 258 ms
106,724 KB
testcase_15 AC 82 ms
90,516 KB
testcase_16 AC 82 ms
90,504 KB
testcase_17 AC 92 ms
92,096 KB
testcase_18 AC 94 ms
92,088 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
def I(): return int(sys.stdin.readline().rstrip())
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))


N = I()
X = LI()
X.sort()

flag = [0]*1000001
for x in X:
    flag[x] = 1

dp = [1]*1000001
for x in X:
    a = dp[x]
    for y in range(2*x,1000001,x):
        if flag[y] == 1:
            dp[y] = max(dp[y],a+1)

print(max(dp))
0