結果
問題 | No.390 最長の数列 |
ユーザー |
![]() |
提出日時 | 2024-12-29 20:39:55 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 848 ms / 5,000 ms |
コード長 | 332 bytes |
コンパイル時間 | 1,281 ms |
コンパイル使用メモリ | 81,792 KB |
実行使用メモリ | 120,960 KB |
最終ジャッジ日時 | 2024-12-29 20:40:02 |
合計ジャッジ時間 | 4,945 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 15 |
ソースコード
from collections import defaultdictimport sysreadline=sys.stdin.readlineN=int(readline())X=sorted(list(map(int,readline().split())))set_X=set(X)dp=defaultdict(int)for x in X:dp[x]=max(dp[x],1)for y in range(2*x,10**6+1,x):if y in set_X:dp[y]=max(dp[y],dp[x]+1)ans=max(dp.values())print(ans)