結果
| 問題 | No.390 最長の数列 |
| コンテスト | |
| ユーザー |
vwxyz
|
| 提出日時 | 2022-09-27 16:12:57 |
| 言語 | Python3 (3.14.3 + numpy 2.4.4 + scipy 1.17.1) |
| 結果 |
AC
|
| 実行時間 | 2,421 ms / 5,000 ms |
| コード長 | 332 bytes |
| 記録 | |
| コンパイル時間 | 403 ms |
| コンパイル使用メモリ | 20,700 KB |
| 実行使用メモリ | 34,996 KB |
| 最終ジャッジ日時 | 2026-05-28 21:44:07 |
| 合計ジャッジ時間 | 11,114 ms |
|
ジャッジサーバーID (参考情報) |
judge2_0 / judge1_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 15 |
ソースコード
from collections import defaultdict
import sys
readline=sys.stdin.readline
N=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)
vwxyz