結果
問題 | No.2218 Multiple LIS |
ユーザー | rlangevin |
提出日時 | 2023-02-17 21:45:07 |
言語 | PyPy3 (7.3.15) |
結果 |
TLE
|
実行時間 | - |
コード長 | 631 bytes |
コンパイル時間 | 276 ms |
コンパイル使用メモリ | 86,580 KB |
実行使用メモリ | 122,776 KB |
最終ジャッジ日時 | 2023-09-26 18:59:24 |
合計ジャッジ時間 | 9,636 ms |
ジャッジサーバーID (参考情報) |
judge14 / judge11 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 92 ms
71,388 KB |
testcase_01 | AC | 92 ms
71,420 KB |
testcase_02 | AC | 92 ms
71,540 KB |
testcase_03 | AC | 92 ms
71,420 KB |
testcase_04 | AC | 91 ms
71,488 KB |
testcase_05 | AC | 92 ms
71,176 KB |
testcase_06 | AC | 90 ms
71,296 KB |
testcase_07 | AC | 90 ms
71,232 KB |
testcase_08 | AC | 94 ms
71,344 KB |
testcase_09 | AC | 94 ms
71,480 KB |
testcase_10 | AC | 94 ms
71,312 KB |
testcase_11 | AC | 93 ms
71,304 KB |
testcase_12 | AC | 111 ms
77,312 KB |
testcase_13 | AC | 128 ms
77,444 KB |
testcase_14 | AC | 126 ms
77,496 KB |
testcase_15 | AC | 123 ms
77,436 KB |
testcase_16 | AC | 106 ms
76,824 KB |
testcase_17 | AC | 129 ms
77,508 KB |
testcase_18 | AC | 99 ms
77,004 KB |
testcase_19 | AC | 102 ms
76,880 KB |
testcase_20 | AC | 128 ms
77,588 KB |
testcase_21 | AC | 1,596 ms
122,776 KB |
testcase_22 | TLE | - |
testcase_23 | -- | - |
testcase_24 | -- | - |
testcase_25 | -- | - |
testcase_26 | -- | - |
testcase_27 | -- | - |
testcase_28 | -- | - |
testcase_29 | -- | - |
testcase_30 | -- | - |
testcase_31 | -- | - |
testcase_32 | -- | - |
testcase_33 | -- | - |
testcase_34 | -- | - |
testcase_35 | -- | - |
testcase_36 | -- | - |
testcase_37 | -- | - |
testcase_38 | -- | - |
testcase_39 | -- | - |
testcase_40 | -- | - |
testcase_41 | -- | - |
ソースコード
from collections import * def div(n): if n <= 0: return [] S = set() i = 1 while i * i <= n: if n % i == 0: S.add(i) S.add(n // i) i += 1 return list(S) N = int(input()) A = list(map(int, input().split())) pre = defaultdict(lambda : -10) pre[1] = 0 for a in A: dp = defaultdict(lambda : -10) for d in div(a): dp[a] = max(dp[a], pre[d] + 1) for k, v in pre.items(): dp[k] = max(dp[k], v) if dp[k] < 0: dp.pop(k) dp, pre = pre, dp ans = 0 for k, v in pre.items(): ans = max(ans, v) print(ans)