結果
問題 |
No.390 最長の数列
|
ユーザー |
![]() |
提出日時 | 2020-11-27 14:12:20 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 258 ms / 5,000 ms |
コード長 | 363 bytes |
コンパイル時間 | 294 ms |
コンパイル使用メモリ | 82,376 KB |
実行使用メモリ | 106,312 KB |
最終ジャッジ日時 | 2024-07-23 21:35:54 |
合計ジャッジ時間 | 3,227 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 15 |
ソースコード
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))