結果

問題 No.390 最長の数列
ユーザー convexineqconvexineq
提出日時 2021-02-02 17:15:48
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 242 ms / 5,000 ms
コード長 232 bytes
コンパイル時間 374 ms
コンパイル使用メモリ 86,980 KB
実行使用メモリ 101,004 KB
最終ジャッジ日時 2023-09-12 11:07:40
合計ジャッジ時間 3,781 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 93 ms
83,664 KB
testcase_01 AC 88 ms
83,608 KB
testcase_02 AC 90 ms
83,632 KB
testcase_03 AC 89 ms
83,572 KB
testcase_04 AC 92 ms
83,628 KB
testcase_05 AC 111 ms
100,592 KB
testcase_06 AC 242 ms
100,668 KB
testcase_07 AC 87 ms
83,804 KB
testcase_08 AC 83 ms
83,516 KB
testcase_09 AC 88 ms
83,720 KB
testcase_10 AC 129 ms
100,936 KB
testcase_11 AC 131 ms
100,680 KB
testcase_12 AC 136 ms
101,004 KB
testcase_13 AC 121 ms
96,628 KB
testcase_14 AC 216 ms
100,496 KB
testcase_15 AC 83 ms
83,580 KB
testcase_16 AC 83 ms
83,472 KB
testcase_17 AC 90 ms
84,464 KB
testcase_18 AC 92 ms
84,204 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n = int(input())
*a, = map(int,input().split())
N = 10**6+1
dp = [0]*N
for ai in a: dp[ai] = 1
for i in range(1,N):
    if dp[i] == 0: continue
    for j in range(2*i,N,i):
        if dp[j]: dp[j] = max(dp[j],dp[i]+1)
print(max(dp))
0