結果
問題 | No.979 Longest Divisor Sequence |
ユーザー | salmon0852 |
提出日時 | 2022-10-27 16:28:34 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 1,627 ms / 2,000 ms |
コード長 | 445 bytes |
コンパイル時間 | 279 ms |
コンパイル使用メモリ | 87,196 KB |
実行使用メモリ | 135,496 KB |
最終ジャッジ日時 | 2023-09-18 10:10:24 |
合計ジャッジ時間 | 5,005 ms |
ジャッジサーバーID (参考情報) |
judge11 / judge15 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 95 ms
71,596 KB |
testcase_01 | AC | 94 ms
71,596 KB |
testcase_02 | AC | 95 ms
71,668 KB |
testcase_03 | AC | 97 ms
71,436 KB |
testcase_04 | AC | 94 ms
71,556 KB |
testcase_05 | AC | 96 ms
71,744 KB |
testcase_06 | AC | 95 ms
71,596 KB |
testcase_07 | AC | 96 ms
71,648 KB |
testcase_08 | AC | 96 ms
71,428 KB |
testcase_09 | AC | 94 ms
71,664 KB |
testcase_10 | AC | 142 ms
77,696 KB |
testcase_11 | AC | 114 ms
77,892 KB |
testcase_12 | AC | 113 ms
77,840 KB |
testcase_13 | AC | 160 ms
128,416 KB |
testcase_14 | AC | 1,627 ms
135,496 KB |
testcase_15 | AC | 410 ms
108,900 KB |
ソースコード
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))