結果

問題 No.390 最長の数列
ユーザー hanorverhanorver
提出日時 2016-09-11 12:53:16
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 2,634 ms / 5,000 ms
コード長 174 bytes
コンパイル時間 107 ms
コンパイル使用メモリ 12,672 KB
実行使用メモリ 24,580 KB
最終ジャッジ日時 2024-04-10 10:06:39
合計ジャッジ時間 6,362 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 26 ms
10,624 KB
testcase_01 AC 28 ms
10,880 KB
testcase_02 AC 28 ms
10,752 KB
testcase_03 AC 29 ms
10,624 KB
testcase_04 AC 29 ms
10,752 KB
testcase_05 AC 156 ms
24,448 KB
testcase_06 AC 2,634 ms
24,336 KB
testcase_07 AC 27 ms
10,752 KB
testcase_08 AC 54 ms
18,460 KB
testcase_09 AC 159 ms
18,344 KB
testcase_10 AC 328 ms
24,504 KB
testcase_11 AC 361 ms
24,464 KB
testcase_12 AC 329 ms
24,580 KB
testcase_13 AC 437 ms
23,312 KB
testcase_14 AC 663 ms
20,596 KB
testcase_15 AC 29 ms
10,880 KB
testcase_16 AC 54 ms
18,496 KB
testcase_17 AC 61 ms
18,832 KB
testcase_18 AC 66 ms
19,132 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

input()
n=sorted(map(int,input().split()))
m=max(n)
dp=[0]*(m+1)
for i in n:dp[i]=1
for i in n:
 for j in range(i*2,m+1,i):
  if dp[j]:dp[j]=max(dp[j],dp[i]+1)
print(max(dp))
0