結果

問題 No.390 最長の数列
ユーザー raven7959raven7959
提出日時 2021-09-01 09:18:58
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 300 ms / 5,000 ms
コード長 227 bytes
コンパイル時間 674 ms
コンパイル使用メモリ 87,096 KB
実行使用メモリ 113,300 KB
最終ジャッジ日時 2023-08-18 05:07:53
合計ジャッジ時間 4,425 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 94 ms
83,596 KB
testcase_01 AC 98 ms
83,860 KB
testcase_02 AC 98 ms
83,924 KB
testcase_03 AC 96 ms
83,964 KB
testcase_04 AC 97 ms
83,804 KB
testcase_05 AC 133 ms
112,952 KB
testcase_06 AC 295 ms
113,292 KB
testcase_07 AC 97 ms
83,744 KB
testcase_08 AC 88 ms
83,772 KB
testcase_09 AC 92 ms
83,960 KB
testcase_10 AC 165 ms
113,296 KB
testcase_11 AC 154 ms
113,300 KB
testcase_12 AC 161 ms
113,124 KB
testcase_13 AC 144 ms
106,668 KB
testcase_14 AC 300 ms
113,032 KB
testcase_15 AC 91 ms
83,624 KB
testcase_16 AC 91 ms
83,908 KB
testcase_17 AC 98 ms
84,564 KB
testcase_18 AC 93 ms
84,620 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N=int(input())
X=set(list(map(int,input().split())))
DP=[0]*(10**6+1)
for x in X:
  DP[x]=1
for i in range(10**6+1):
  if DP[i]:
    for j in range(2*i,10**6+1,i):
      if DP[j]:
        DP[j]=max(DP[j],DP[i]+1)
print(max(DP))
0