結果

問題 No.2218 Multiple LIS
ユーザー shakayamishakayami
提出日時 2023-02-17 21:58:48
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 354 ms / 3,000 ms
コード長 475 bytes
コンパイル時間 1,122 ms
コンパイル使用メモリ 86,504 KB
実行使用メモリ 104,920 KB
最終ジャッジ日時 2023-09-26 19:16:18
合計ジャッジ時間 9,188 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 74 ms
70,936 KB
testcase_01 AC 74 ms
71,024 KB
testcase_02 AC 75 ms
70,796 KB
testcase_03 AC 74 ms
70,968 KB
testcase_04 AC 74 ms
70,832 KB
testcase_05 AC 75 ms
71,020 KB
testcase_06 AC 74 ms
71,000 KB
testcase_07 AC 74 ms
71,104 KB
testcase_08 AC 72 ms
70,660 KB
testcase_09 AC 72 ms
70,924 KB
testcase_10 AC 74 ms
71,124 KB
testcase_11 AC 75 ms
70,900 KB
testcase_12 AC 80 ms
75,688 KB
testcase_13 AC 84 ms
76,116 KB
testcase_14 AC 85 ms
76,028 KB
testcase_15 AC 83 ms
76,168 KB
testcase_16 AC 74 ms
70,828 KB
testcase_17 AC 81 ms
75,876 KB
testcase_18 AC 73 ms
70,904 KB
testcase_19 AC 75 ms
71,100 KB
testcase_20 AC 84 ms
75,832 KB
testcase_21 AC 220 ms
100,212 KB
testcase_22 AC 260 ms
99,988 KB
testcase_23 AC 270 ms
99,756 KB
testcase_24 AC 240 ms
99,760 KB
testcase_25 AC 279 ms
99,588 KB
testcase_26 AC 315 ms
98,992 KB
testcase_27 AC 320 ms
99,120 KB
testcase_28 AC 322 ms
98,936 KB
testcase_29 AC 316 ms
99,060 KB
testcase_30 AC 354 ms
99,444 KB
testcase_31 AC 186 ms
95,444 KB
testcase_32 AC 204 ms
95,104 KB
testcase_33 AC 194 ms
95,276 KB
testcase_34 AC 193 ms
95,120 KB
testcase_35 AC 187 ms
95,368 KB
testcase_36 AC 101 ms
90,296 KB
testcase_37 AC 259 ms
104,920 KB
testcase_38 AC 74 ms
71,040 KB
testcase_39 AC 74 ms
70,828 KB
testcase_40 AC 193 ms
98,368 KB
testcase_41 AC 192 ms
98,156 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N=int(input())
A=[int(i) for i in input().split()]
maxA=max(A)
div=[[] for i in range(maxA+1)]
for i in range(1,maxA+1):
    for j in range(i,maxA+1,i):
        div[j].append(i)
B=[[] for i in range(maxA+1)]
dp=[0 for i in range(N)]
for i in range(N):
    #dp[i] i番目が最後であるような列のmax
    dp[i]=max(dp[i],1)
    for d in div[A[i]]:
        if len(B[d])>0:
            j=B[d][-1]
            dp[i]=max(dp[i],dp[j]+1)
    B[A[i]].append(i)
print(max(dp))
0