結果

問題 No.2218 Multiple LIS
ユーザー FromBooskaFromBooska
提出日時 2023-10-15 16:36:59
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 750 ms / 3,000 ms
コード長 619 bytes
コンパイル時間 363 ms
コンパイル使用メモリ 87,024 KB
実行使用メモリ 93,312 KB
最終ジャッジ日時 2023-10-15 16:37:12
合計ジャッジ時間 12,321 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 76 ms
75,984 KB
testcase_01 AC 74 ms
75,848 KB
testcase_02 AC 75 ms
75,960 KB
testcase_03 AC 75 ms
75,816 KB
testcase_04 AC 73 ms
75,900 KB
testcase_05 AC 76 ms
75,900 KB
testcase_06 AC 71 ms
75,744 KB
testcase_07 AC 74 ms
76,196 KB
testcase_08 AC 73 ms
75,888 KB
testcase_09 AC 74 ms
75,884 KB
testcase_10 AC 73 ms
75,964 KB
testcase_11 AC 73 ms
75,988 KB
testcase_12 AC 77 ms
76,948 KB
testcase_13 AC 86 ms
77,048 KB
testcase_14 AC 86 ms
77,000 KB
testcase_15 AC 84 ms
77,376 KB
testcase_16 AC 76 ms
76,804 KB
testcase_17 AC 84 ms
77,220 KB
testcase_18 AC 76 ms
76,200 KB
testcase_19 AC 77 ms
76,416 KB
testcase_20 AC 85 ms
77,148 KB
testcase_21 AC 109 ms
77,336 KB
testcase_22 AC 243 ms
81,892 KB
testcase_23 AC 350 ms
85,464 KB
testcase_24 AC 141 ms
78,148 KB
testcase_25 AC 383 ms
86,740 KB
testcase_26 AC 506 ms
91,624 KB
testcase_27 AC 512 ms
91,556 KB
testcase_28 AC 515 ms
91,444 KB
testcase_29 AC 505 ms
91,420 KB
testcase_30 AC 505 ms
91,640 KB
testcase_31 AC 230 ms
90,836 KB
testcase_32 AC 253 ms
90,912 KB
testcase_33 AC 225 ms
90,764 KB
testcase_34 AC 225 ms
90,948 KB
testcase_35 AC 254 ms
90,960 KB
testcase_36 AC 108 ms
90,244 KB
testcase_37 AC 750 ms
93,312 KB
testcase_38 AC 72 ms
76,028 KB
testcase_39 AC 72 ms
76,008 KB
testcase_40 AC 711 ms
91,600 KB
testcase_41 AC 734 ms
91,608 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

# 約数値の最大に+1するか

def 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()))
num_count = [0]*(10**5+3)

for a in A:
    divs = divisors(a)
    mx = 0
    for d in divs:
        mx = max(mx, num_count[d])
    num_count[a] = max(num_count[a], mx+1)
    #print('a', a, num_count[:10])
    
ans = max(num_count)
print(ans)
0