結果
| 問題 | No.979 Longest Divisor Sequence |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2022-10-27 16:28:34 |
| 言語 | PyPy3 (8.0.0 + ACL) |
| 結果 |
TLE
不安定
(最新)
AC
(最初)
|
| 実行時間 | - |
| コード長 | 445 bytes |
| 記録 | |
| コンパイル時間 | 81 ms |
| コンパイル使用メモリ | 64,512 KB |
| 実行使用メモリ | 101,156 KB |
| 最終ジャッジ日時 | 2026-10-15 14:34:29 |
| 合計ジャッジ時間 | 6,951 ms |
|
ジャッジサーバーID (参考情報) |
judge5_0 / judge4_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 17 TLE * 1 |
ソースコード
from collections import defaultdict
from bisect import bisect_right
n = int(input())
a = [int(i) for i in input().split()]
max_a = max(a)
cnt = [1] * n
d = defaultdict(list)
for i in range(n): d[a[i]].append(i)
for i in range(n):
x = 2 * a[i]
while x <= max_a:
if x in d:
s = bisect_right(d[x], i)
for j in d[x][s:]:
cnt[j] = max(cnt[j], cnt[i] + 1)
x += a[i]
print(max(cnt))