結果

問題 No.390 最長の数列
ユーザー MitI_7MitI_7
提出日時 2016-09-19 12:17:39
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 4,213 ms / 5,000 ms
コード長 307 bytes
コンパイル時間 302 ms
コンパイル使用メモリ 12,672 KB
実行使用メモリ 25,188 KB
最終ジャッジ日時 2024-04-10 10:07:52
合計ジャッジ時間 8,949 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 26 ms
10,880 KB
testcase_01 AC 27 ms
10,752 KB
testcase_02 AC 27 ms
10,624 KB
testcase_03 AC 28 ms
10,624 KB
testcase_04 AC 27 ms
10,752 KB
testcase_05 AC 174 ms
25,188 KB
testcase_06 AC 4,213 ms
24,880 KB
testcase_07 AC 28 ms
10,624 KB
testcase_08 AC 70 ms
18,560 KB
testcase_09 AC 179 ms
18,560 KB
testcase_10 AC 374 ms
25,140 KB
testcase_11 AC 422 ms
25,184 KB
testcase_12 AC 390 ms
25,184 KB
testcase_13 AC 442 ms
24,336 KB
testcase_14 AC 1,026 ms
20,504 KB
testcase_15 AC 27 ms
10,752 KB
testcase_16 AC 69 ms
18,560 KB
testcase_17 AC 80 ms
18,944 KB
testcase_18 AC 89 ms
19,200 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n = int(input())
x_list = sorted(map(int, input().split()))
max_x = max(x_list) + 1
l = [0 for i in range(max_x)]
for x in x_list:
    l[x] = 1

ans = 1
for x in x_list:
    for m in range(x * 2, max_x, x):
        if l[m]:
            l[m] = max(l[m], l[x] + 1)
            ans = max(ans, l[m])
print(ans)
0