結果

問題 No.390 最長の数列
ユーザー takakintakakin
提出日時 2020-05-16 22:16:30
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 2,479 ms / 5,000 ms
コード長 310 bytes
コンパイル時間 1,488 ms
コンパイル使用メモリ 81,620 KB
実行使用メモリ 86,224 KB
最終ジャッジ日時 2023-10-24 03:57:52
合計ジャッジ時間 6,754 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 38 ms
53,444 KB
testcase_01 AC 42 ms
59,044 KB
testcase_02 AC 45 ms
59,060 KB
testcase_03 AC 38 ms
53,444 KB
testcase_04 AC 39 ms
53,444 KB
testcase_05 AC 77 ms
77,128 KB
testcase_06 AC 2,479 ms
85,384 KB
testcase_07 AC 39 ms
53,444 KB
testcase_08 AC 39 ms
53,444 KB
testcase_09 AC 126 ms
75,224 KB
testcase_10 AC 422 ms
86,224 KB
testcase_11 AC 472 ms
86,224 KB
testcase_12 AC 444 ms
86,224 KB
testcase_13 AC 769 ms
82,928 KB
testcase_14 AC 455 ms
85,924 KB
testcase_15 AC 38 ms
53,444 KB
testcase_16 AC 42 ms
59,072 KB
testcase_17 AC 81 ms
75,896 KB
testcase_18 AC 88 ms
75,896 KB
権限があれば一括ダウンロードができます

ソースコード

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