結果

問題 No.390 最長の数列
ユーザー tktk_snsntktk_snsn
提出日時 2021-03-20 13:05:30
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
TLE  
実行時間 -
コード長 244 bytes
コンパイル時間 248 ms
コンパイル使用メモリ 12,800 KB
実行使用メモリ 31,584 KB
最終ジャッジ日時 2024-04-30 23:26:23
合計ジャッジ時間 24,453 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1,300 ms
18,524 KB
testcase_01 AC 554 ms
18,492 KB
testcase_02 AC 1,095 ms
18,464 KB
testcase_03 AC 723 ms
18,488 KB
testcase_04 AC 1,125 ms
18,476 KB
testcase_05 AC 163 ms
24,404 KB
testcase_06 TLE -
testcase_07 AC 597 ms
18,456 KB
testcase_08 AC 37 ms
18,620 KB
testcase_09 AC 587 ms
18,456 KB
testcase_10 AC 782 ms
24,592 KB
testcase_11 AC 933 ms
24,480 KB
testcase_12 AC 829 ms
24,592 KB
testcase_13 AC 1,761 ms
23,760 KB
testcase_14 TLE -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

U = 10**6
N = int(input())
X = list(map(int, input().split()))
X.sort()

dp = [0] * (U + 1)
for i in X:
    dp[i] = max(dp[i], 1)
    j = 2 * i
    while j <= U:
        dp[j] = max(dp[j], dp[i] + 1)
        j += i

print(max(dp[i] for i in X))
0