結果
| 問題 |
No.2218 Multiple LIS
|
| コンテスト | |
| ユーザー |
FromBooska
|
| 提出日時 | 2023-02-18 10:06:16 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 436 bytes |
| コンパイル時間 | 179 ms |
| コンパイル使用メモリ | 82,688 KB |
| 実行使用メモリ | 76,672 KB |
| 最終ジャッジ日時 | 2024-07-19 21:49:23 |
| 合計ジャッジ時間 | 6,304 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 19 TLE * 1 -- * 19 |
ソースコード
# dpでTLEした
# エラトステネスのようにやるか
N = int(input())
A = list(map(int, input().split()))
#from collections import defaultdict
#A_position = defaultdict(list)
#for i in range(N):
# A_position[A[i]].append(i)
dp = [1]*N
maxA = max(A)
for i in range(N):
current = dp[i]
for j in range(i+1, N):
if A[j]%A[i] == 0:
dp[j] = max(dp[j], current+1)
#print(dp)
ans = max(dp)
print(ans)
FromBooska