結果
| 問題 |
No.390 最長の数列
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2016-10-15 10:00:32 |
| 言語 | PyPy2 (7.3.15) |
| 結果 |
AC
|
| 実行時間 | 668 ms / 5,000 ms |
| コード長 | 291 bytes |
| コンパイル時間 | 719 ms |
| コンパイル使用メモリ | 77,064 KB |
| 実行使用メモリ | 104,564 KB |
| 最終ジャッジ日時 | 2024-10-02 12:02:02 |
| 合計ジャッジ時間 | 4,808 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 15 |
ソースコード
N = input()
x = sorted(map(int, raw_input().split()))
m = max(x)
dp = [float('-inf') for _ in xrange(m+1)]
for a in x:
dp[a] = 1
for a in x:
b = a*2
c = dp[a]
while b <= m:
if dp[b] != float('-inf'):
dp[b] = max(c+1, dp[b])
b += a
print max(dp)