結果

問題 No.390 最長の数列
ユーザー MitI_7MitI_7
提出日時 2016-09-19 12:13:57
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 280 bytes
コンパイル時間 95 ms
コンパイル使用メモリ 12,544 KB
実行使用メモリ 30,892 KB
最終ジャッジ日時 2024-04-28 15:49:46
合計ジャッジ時間 47,926 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1,863 ms
18,560 KB
testcase_01 AC 1,874 ms
18,560 KB
testcase_02 AC 1,909 ms
18,688 KB
testcase_03 AC 1,846 ms
18,560 KB
testcase_04 AC 1,882 ms
18,560 KB
testcase_05 AC 3,010 ms
30,592 KB
testcase_06 AC 4,794 ms
30,696 KB
testcase_07 AC 1,968 ms
18,560 KB
testcase_08 AC 1,883 ms
18,560 KB
testcase_09 WA -
testcase_10 AC 3,055 ms
30,596 KB
testcase_11 AC 3,245 ms
30,508 KB
testcase_12 AC 2,982 ms
30,688 KB
testcase_13 AC 2,077 ms
25,784 KB
testcase_14 AC 2,927 ms
30,892 KB
testcase_15 AC 1,873 ms
18,560 KB
testcase_16 AC 1,961 ms
18,560 KB
testcase_17 AC 1,900 ms
19,200 KB
testcase_18 AC 1,901 ms
19,840 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n = int(input())
x = set(map(int, input().split()))
l = [1 if i in x else 0 for i in range(10 ** 6 + 1)]
ans = 1
for x in range(1, 10 ** 6):
    for m in range(x * 2, 10 ** 6, x):
        if l[m]:
            l[m] = max(l[m], l[x] + 1)
            ans = max(ans, l[m])
print(ans)
0