結果

問題 No.390 最長の数列
ユーザー rlangevinrlangevin
提出日時 2023-10-11 12:13:46
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 294 ms / 5,000 ms
コード長 234 bytes
コンパイル時間 268 ms
コンパイル使用メモリ 86,920 KB
実行使用メモリ 99,232 KB
最終ジャッジ日時 2023-10-11 12:13:51
合計ジャッジ時間 3,414 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 72 ms
71,256 KB
testcase_01 AC 71 ms
71,432 KB
testcase_02 AC 75 ms
71,512 KB
testcase_03 AC 71 ms
71,160 KB
testcase_04 AC 72 ms
71,412 KB
testcase_05 AC 130 ms
98,876 KB
testcase_06 AC 294 ms
98,204 KB
testcase_07 AC 72 ms
71,392 KB
testcase_08 AC 77 ms
82,848 KB
testcase_09 AC 84 ms
83,572 KB
testcase_10 AC 171 ms
99,108 KB
testcase_11 AC 147 ms
99,072 KB
testcase_12 AC 146 ms
99,232 KB
testcase_13 AC 187 ms
94,976 KB
testcase_14 AC 131 ms
91,924 KB
testcase_15 AC 73 ms
75,072 KB
testcase_16 AC 77 ms
82,772 KB
testcase_17 AC 89 ms
84,240 KB
testcase_18 AC 91 ms
84,336 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N = int(input())
X = list(map(int, input().split()))
X.sort(reverse=True)
M = max(X)
dp = [0] * (M + 1)
for x in X:
    now = 0
    for i in range(2 * x, M + 1, x):
        now = max(now, dp[i])
    dp[x] = now + 1
    
print(max(dp))
0