結果
| 問題 | No.390 最長の数列 |
| コンテスト | |
| ユーザー |
vwxyz
|
| 提出日時 | 2022-09-27 16:12:57 |
| 言語 | Python3 (3.15.0 + numpy 2.5.4 + scipy 1.18.1 + ACL) |
| 結果 |
AC
不安定
|
| 実行時間 | 2,186 ms / 5,000 ms |
| + 333µs | |
| コード長 | 332 bytes |
| 記録 | |
| コンパイル時間 | 54 ms |
| コンパイル使用メモリ | 15,104 KB |
| 実行使用メモリ | 31,968 KB |
| 最終ジャッジ日時 | 2026-10-06 01:58:54 |
| 合計ジャッジ時間 | 8,740 ms |
|
ジャッジサーバーID (参考情報) |
judge4_0 / judge3_1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| 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