結果

問題 No.2218 Multiple LIS
ユーザー ntudantuda
提出日時 2023-02-20 17:00:28
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 634 bytes
コンパイル時間 1,606 ms
コンパイル使用メモリ 86,648 KB
実行使用メモリ 121,360 KB
最終ジャッジ日時 2023-09-28 14:19:55
合計ジャッジ時間 13,803 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 76 ms
75,396 KB
testcase_01 AC 75 ms
70,904 KB
testcase_02 AC 75 ms
71,212 KB
testcase_03 AC 74 ms
71,112 KB
testcase_04 AC 74 ms
71,012 KB
testcase_05 AC 76 ms
70,684 KB
testcase_06 AC 75 ms
70,676 KB
testcase_07 AC 74 ms
70,916 KB
testcase_08 AC 74 ms
71,160 KB
testcase_09 AC 74 ms
71,164 KB
testcase_10 AC 75 ms
71,088 KB
testcase_11 AC 75 ms
71,112 KB
testcase_12 AC 88 ms
76,064 KB
testcase_13 AC 95 ms
76,324 KB
testcase_14 AC 94 ms
75,932 KB
testcase_15 AC 91 ms
75,644 KB
testcase_16 AC 79 ms
74,992 KB
testcase_17 AC 91 ms
75,940 KB
testcase_18 AC 75 ms
71,208 KB
testcase_19 AC 78 ms
75,036 KB
testcase_20 AC 89 ms
75,860 KB
testcase_21 AC 141 ms
82,508 KB
testcase_22 AC 323 ms
92,196 KB
testcase_23 AC 472 ms
101,668 KB
testcase_24 AC 186 ms
84,872 KB
testcase_25 AC 524 ms
103,012 KB
testcase_26 AC 698 ms
120,860 KB
testcase_27 AC 709 ms
121,172 KB
testcase_28 AC 705 ms
121,044 KB
testcase_29 AC 716 ms
121,164 KB
testcase_30 AC 704 ms
121,360 KB
testcase_31 TLE -
testcase_32 -- -
testcase_33 -- -
testcase_34 -- -
testcase_35 -- -
testcase_36 -- -
testcase_37 -- -
testcase_38 -- -
testcase_39 -- -
testcase_40 -- -
testcase_41 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

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


N = int(input())
A = list(map(int, input().split()))
maxa = max(A)
C = [[] for _ in range(maxa + 1)]
E = [0] * (maxa + 1)
for a in reversed(A):
    tmp = 0
    if C[a]:
        for x in C[a]:
            tmp = max(tmp, E[x])

    E[a] = max(E[a], tmp + 1)

    D = make_divisors(a)
    for d in D:
        C[d].append(a)

print(max(E))
0