結果

問題 No.2218 Multiple LIS
ユーザー FromBooskaFromBooska
提出日時 2024-02-21 12:13:26
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 691 ms / 3,000 ms
コード長 638 bytes
コンパイル時間 276 ms
コンパイル使用メモリ 81,572 KB
実行使用メモリ 91,948 KB
最終ジャッジ日時 2024-02-21 12:13:37
合計ジャッジ時間 11,026 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 39 ms
57,812 KB
testcase_01 AC 40 ms
57,812 KB
testcase_02 AC 58 ms
57,812 KB
testcase_03 AC 39 ms
57,812 KB
testcase_04 AC 39 ms
57,812 KB
testcase_05 AC 39 ms
57,812 KB
testcase_06 AC 39 ms
57,812 KB
testcase_07 AC 41 ms
57,812 KB
testcase_08 AC 39 ms
57,812 KB
testcase_09 AC 39 ms
57,812 KB
testcase_10 AC 40 ms
57,812 KB
testcase_11 AC 39 ms
57,812 KB
testcase_12 AC 44 ms
60,624 KB
testcase_13 AC 52 ms
65,108 KB
testcase_14 AC 50 ms
65,112 KB
testcase_15 AC 51 ms
65,260 KB
testcase_16 AC 41 ms
60,380 KB
testcase_17 AC 50 ms
65,232 KB
testcase_18 AC 39 ms
57,812 KB
testcase_19 AC 42 ms
60,380 KB
testcase_20 AC 50 ms
65,260 KB
testcase_21 AC 75 ms
73,464 KB
testcase_22 AC 205 ms
80,268 KB
testcase_23 AC 331 ms
83,932 KB
testcase_24 AC 107 ms
76,540 KB
testcase_25 AC 334 ms
85,248 KB
testcase_26 AC 451 ms
90,036 KB
testcase_27 AC 479 ms
90,036 KB
testcase_28 AC 452 ms
90,036 KB
testcase_29 AC 475 ms
90,036 KB
testcase_30 AC 449 ms
90,028 KB
testcase_31 AC 200 ms
89,600 KB
testcase_32 AC 222 ms
89,480 KB
testcase_33 AC 189 ms
89,472 KB
testcase_34 AC 218 ms
89,468 KB
testcase_35 AC 222 ms
89,608 KB
testcase_36 AC 76 ms
88,796 KB
testcase_37 AC 686 ms
91,948 KB
testcase_38 AC 39 ms
57,812 KB
testcase_39 AC 53 ms
57,812 KB
testcase_40 AC 664 ms
90,064 KB
testcase_41 AC 691 ms
90,064 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()))

div_count = [0]*(10**5+3)

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

#print(div_count[:40])
0