結果

問題 No.2218 Multiple LIS
ユーザー ShirotsumeShirotsume
提出日時 2023-02-14 07:36:45
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 473 ms / 3,000 ms
コード長 739 bytes
コンパイル時間 508 ms
コンパイル使用メモリ 86,648 KB
実行使用メモリ 100,212 KB
最終ジャッジ日時 2023-09-23 17:35:08
合計ジャッジ時間 10,051 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 83 ms
71,212 KB
testcase_01 AC 84 ms
71,560 KB
testcase_02 AC 84 ms
71,256 KB
testcase_03 AC 86 ms
71,504 KB
testcase_04 AC 85 ms
71,484 KB
testcase_05 AC 88 ms
71,520 KB
testcase_06 AC 83 ms
71,304 KB
testcase_07 AC 81 ms
71,468 KB
testcase_08 AC 85 ms
71,404 KB
testcase_09 AC 84 ms
71,456 KB
testcase_10 AC 85 ms
71,216 KB
testcase_11 AC 86 ms
71,284 KB
testcase_12 AC 104 ms
76,660 KB
testcase_13 AC 99 ms
77,048 KB
testcase_14 AC 97 ms
76,820 KB
testcase_15 AC 93 ms
76,908 KB
testcase_16 AC 83 ms
71,516 KB
testcase_17 AC 94 ms
76,852 KB
testcase_18 AC 83 ms
71,336 KB
testcase_19 AC 86 ms
71,292 KB
testcase_20 AC 96 ms
77,068 KB
testcase_21 AC 128 ms
79,148 KB
testcase_22 AC 261 ms
92,272 KB
testcase_23 AC 353 ms
99,796 KB
testcase_24 AC 158 ms
79,320 KB
testcase_25 AC 377 ms
99,460 KB
testcase_26 AC 443 ms
99,868 KB
testcase_27 AC 445 ms
99,868 KB
testcase_28 AC 453 ms
100,144 KB
testcase_29 AC 473 ms
100,212 KB
testcase_30 AC 441 ms
100,108 KB
testcase_31 AC 125 ms
92,580 KB
testcase_32 AC 124 ms
92,464 KB
testcase_33 AC 126 ms
92,540 KB
testcase_34 AC 128 ms
92,500 KB
testcase_35 AC 126 ms
92,568 KB
testcase_36 AC 110 ms
90,188 KB
testcase_37 AC 155 ms
99,316 KB
testcase_38 AC 84 ms
71,480 KB
testcase_39 AC 84 ms
71,364 KB
testcase_40 AC 148 ms
95,536 KB
testcase_41 AC 153 ms
95,444 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
from collections import deque, Counter
input = lambda: sys.stdin.readline().rstrip()
ii = lambda: int(input())
mi = lambda: map(int, input().split())
li = lambda: list(mi())
inf = 2 ** 63 - 1
mod = 998244353
#すみませんでした… breakがcontinueになってた
n = ii()
a = li()

dp = [-inf] * (n + 1)
dp[0] = 1
maxi = [0] * (max(a) + 1)
div = [set() for _ in range(max(a) + 1)]
for idx, v in enumerate(a):
    v2 = v
    if not div[v]:
        for i in range(1, v2 + 1):
            if i * i > v2:
                break
            if v2 % i == 0:
                div[v].add(i)
                div[v].add(v2 // i)
    for v2 in div[v]:
        dp[idx] = max(dp[idx], maxi[v2] + 1)
    maxi[v] = dp[idx]

print(max(dp))
0