結果

問題 No.390 最長の数列
ユーザー takakintakakin
提出日時 2020-05-16 22:16:06
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
TLE  
実行時間 -
コード長 310 bytes
コンパイル時間 97 ms
コンパイル使用メモリ 11,880 KB
実行使用メモリ 21,516 KB
最終ジャッジ日時 2023-10-24 03:57:43
合計ジャッジ時間 7,451 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 31 ms
9,992 KB
testcase_01 AC 31 ms
9,992 KB
testcase_02 AC 31 ms
9,992 KB
testcase_03 AC 29 ms
9,992 KB
testcase_04 AC 30 ms
9,992 KB
testcase_05 AC 124 ms
21,516 KB
testcase_06 TLE -
testcase_07 -- -
testcase_08 -- -
testcase_09 -- -
testcase_10 -- -
testcase_11 -- -
testcase_12 -- -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
input=lambda: sys.stdin.readline().rstrip()
import bisect
n=int(input())
X=sorted([int(i) for i in input().split()])
A=[1]*n
for i,x in enumerate(X):
  mul=2
  while mul*x<=X[-1]:
    ind=bisect.bisect_left(X,mul*x)
    if mul*x==X[ind]:
      A[ind]=max(A[ind],A[i]+1)
    mul+=1
print(max(A))

  
0