結果

問題 No.2218 Multiple LIS
ユーザー lloyzlloyz
提出日時 2023-02-27 21:41:57
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 736 ms / 3,000 ms
コード長 439 bytes
コンパイル時間 317 ms
コンパイル使用メモリ 87,200 KB
実行使用メモリ 93,384 KB
最終ジャッジ日時 2023-10-13 06:15:48
合計ジャッジ時間 12,072 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 68 ms
71,152 KB
testcase_01 AC 67 ms
71,184 KB
testcase_02 AC 69 ms
71,428 KB
testcase_03 AC 68 ms
71,508 KB
testcase_04 AC 68 ms
71,480 KB
testcase_05 AC 67 ms
71,344 KB
testcase_06 AC 68 ms
71,480 KB
testcase_07 AC 68 ms
71,432 KB
testcase_08 AC 69 ms
71,360 KB
testcase_09 AC 68 ms
71,144 KB
testcase_10 AC 68 ms
71,580 KB
testcase_11 AC 69 ms
71,244 KB
testcase_12 AC 75 ms
75,960 KB
testcase_13 AC 81 ms
76,388 KB
testcase_14 AC 80 ms
76,340 KB
testcase_15 AC 82 ms
76,308 KB
testcase_16 AC 72 ms
75,500 KB
testcase_17 AC 82 ms
76,272 KB
testcase_18 AC 70 ms
71,300 KB
testcase_19 AC 72 ms
75,580 KB
testcase_20 AC 84 ms
76,576 KB
testcase_21 AC 105 ms
77,548 KB
testcase_22 AC 237 ms
81,796 KB
testcase_23 AC 340 ms
85,484 KB
testcase_24 AC 136 ms
78,036 KB
testcase_25 AC 376 ms
86,756 KB
testcase_26 AC 495 ms
91,516 KB
testcase_27 AC 496 ms
91,580 KB
testcase_28 AC 498 ms
91,524 KB
testcase_29 AC 501 ms
91,716 KB
testcase_30 AC 496 ms
91,552 KB
testcase_31 AC 224 ms
90,616 KB
testcase_32 AC 247 ms
90,624 KB
testcase_33 AC 221 ms
90,840 KB
testcase_34 AC 220 ms
90,788 KB
testcase_35 AC 245 ms
90,620 KB
testcase_36 AC 105 ms
89,664 KB
testcase_37 AC 736 ms
93,384 KB
testcase_38 AC 66 ms
71,404 KB
testcase_39 AC 69 ms
71,456 KB
testcase_40 AC 704 ms
91,372 KB
testcase_41 AC 700 ms
91,192 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n = int(input())
A = list(map(int, input().split()))

def divisors(n):
    L, R = [], []
    i = 1
    while i * i <= n:
        if n % i == 0:
            L.append(i)
            if n // i != i:
                R.append(n // i)
        i += 1
    return L + R[::-1]

DP = [0 for _ in range(max(A) + 1)]
for i in range(n):
    a = A[i]
    res = 0
    for d in divisors(a):
        res = max(res, DP[d])
    DP[a] = res + 1
print(max(DP))
0