結果

問題 No.390 最長の数列
ユーザー ああいいああいい
提出日時 2022-03-30 00:21:41
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 543 ms / 5,000 ms
コード長 295 bytes
コンパイル時間 282 ms
コンパイル使用メモリ 82,304 KB
実行使用メモリ 105,984 KB
最終ジャッジ日時 2024-04-26 09:35:58
合計ジャッジ時間 3,129 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 33 ms
51,968 KB
testcase_01 AC 34 ms
51,968 KB
testcase_02 AC 32 ms
51,712 KB
testcase_03 AC 32 ms
51,968 KB
testcase_04 AC 34 ms
51,840 KB
testcase_05 AC 87 ms
99,000 KB
testcase_06 AC 543 ms
105,580 KB
testcase_07 AC 35 ms
51,456 KB
testcase_08 AC 35 ms
52,224 KB
testcase_09 AC 44 ms
57,856 KB
testcase_10 AC 141 ms
105,728 KB
testcase_11 AC 147 ms
105,464 KB
testcase_12 AC 152 ms
105,728 KB
testcase_13 AC 121 ms
94,336 KB
testcase_14 AC 157 ms
105,984 KB
testcase_15 AC 35 ms
51,968 KB
testcase_16 AC 34 ms
51,968 KB
testcase_17 AC 48 ms
64,384 KB
testcase_18 AC 50 ms
66,048 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N = int(input())
x = list(map(int,input().split()))
x.sort()

d = dict()
for i in x:
    d[i] = 1
C = max(x) + 1
for i in x:
    u = d[i]
    for j in range(2 * i,C,i):
        if j in d:
            d[j] = max(d[j],u + 1)
ans = 0
for v in d.values():
    if v > ans:
        ans = v
print(ans)
0