結果

問題 No.2218 Multiple LIS
ユーザー FromBooskaFromBooska
提出日時 2023-02-18 10:49:40
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 657 ms / 3,000 ms
コード長 464 bytes
コンパイル時間 1,443 ms
コンパイル使用メモリ 86,840 KB
実行使用メモリ 92,584 KB
最終ジャッジ日時 2023-09-27 04:40:50
合計ジャッジ時間 11,269 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 71 ms
71,456 KB
testcase_01 AC 72 ms
71,416 KB
testcase_02 AC 73 ms
71,364 KB
testcase_03 AC 72 ms
71,376 KB
testcase_04 AC 72 ms
71,360 KB
testcase_05 AC 72 ms
71,360 KB
testcase_06 AC 71 ms
71,156 KB
testcase_07 AC 72 ms
71,308 KB
testcase_08 AC 73 ms
71,208 KB
testcase_09 AC 72 ms
71,060 KB
testcase_10 AC 73 ms
71,372 KB
testcase_11 AC 73 ms
71,372 KB
testcase_12 AC 77 ms
75,740 KB
testcase_13 AC 81 ms
76,412 KB
testcase_14 AC 81 ms
76,364 KB
testcase_15 AC 83 ms
76,360 KB
testcase_16 AC 86 ms
75,832 KB
testcase_17 AC 81 ms
76,544 KB
testcase_18 AC 73 ms
71,448 KB
testcase_19 AC 76 ms
76,120 KB
testcase_20 AC 81 ms
76,352 KB
testcase_21 AC 109 ms
77,356 KB
testcase_22 AC 241 ms
81,060 KB
testcase_23 AC 338 ms
85,456 KB
testcase_24 AC 141 ms
77,576 KB
testcase_25 AC 378 ms
86,772 KB
testcase_26 AC 508 ms
91,384 KB
testcase_27 AC 513 ms
91,316 KB
testcase_28 AC 515 ms
91,648 KB
testcase_29 AC 508 ms
91,236 KB
testcase_30 AC 489 ms
91,516 KB
testcase_31 AC 207 ms
90,712 KB
testcase_32 AC 224 ms
90,572 KB
testcase_33 AC 208 ms
90,544 KB
testcase_34 AC 207 ms
90,468 KB
testcase_35 AC 227 ms
90,404 KB
testcase_36 AC 96 ms
89,352 KB
testcase_37 AC 657 ms
92,584 KB
testcase_38 AC 74 ms
71,368 KB
testcase_39 AC 73 ms
71,448 KB
testcase_40 AC 657 ms
91,040 KB
testcase_41 AC 655 ms
91,392 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

# 公式解説
# dp[i][j]:= Aiまで見て最後に選んだ数がjのときの最長部分列の長さ

N = int(input())
A = list(map(int, input().split()))
maxA = max(A)
dp = [0]*(maxA+1)

for i in range(1, N+1):
    num = A[i-1]
    mx = 0
    for k in range(1, num+1):
        if k*k > num:
            break
        if num%k == 0:
            mx = max(mx, dp[k])
            mx = max(mx, dp[num//k])
    dp[num] = mx+1
    #print(dp)

ans = max(dp)
print(ans)
0