結果

問題 No.390 最長の数列
ユーザー 👑 H20H20
提出日時 2021-01-21 13:33:46
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 776 ms / 5,000 ms
コード長 273 bytes
コンパイル時間 308 ms
コンパイル使用メモリ 86,976 KB
実行使用メモリ 107,600 KB
最終ジャッジ日時 2023-08-26 00:47:04
合計ジャッジ時間 4,928 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 99 ms
71,236 KB
testcase_01 AC 102 ms
71,384 KB
testcase_02 AC 99 ms
71,576 KB
testcase_03 AC 100 ms
71,548 KB
testcase_04 AC 98 ms
71,652 KB
testcase_05 AC 172 ms
106,708 KB
testcase_06 AC 776 ms
107,600 KB
testcase_07 AC 99 ms
71,664 KB
testcase_08 AC 99 ms
71,684 KB
testcase_09 AC 114 ms
76,676 KB
testcase_10 AC 221 ms
106,640 KB
testcase_11 AC 226 ms
106,776 KB
testcase_12 AC 230 ms
107,208 KB
testcase_13 AC 197 ms
99,608 KB
testcase_14 AC 269 ms
106,396 KB
testcase_15 AC 98 ms
71,740 KB
testcase_16 AC 100 ms
71,712 KB
testcase_17 AC 116 ms
77,700 KB
testcase_18 AC 116 ms
77,696 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import bisect
import collections
N = int(input())
A = list(map(int,input().split()))
CA = collections.Counter(A)
MA = max(A)
A.sort()
for a in A:
    i=2
    while MA>=a*i:
        if CA[a*i]>0:
            CA[a*i]=max(CA[a*i],CA[a]+1)
        i+=1

print(max(CA.values()))
0