結果

問題 No.390 最長の数列
ユーザー konsin_tokagekonsin_tokage
提出日時 2018-04-07 08:31:31
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 395 bytes
コンパイル時間 298 ms
コンパイル使用メモリ 87,220 KB
実行使用メモリ 100,120 KB
最終ジャッジ日時 2023-09-08 18:11:32
合計ジャッジ時間 3,494 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 107 ms
91,672 KB
testcase_01 AC 100 ms
91,628 KB
testcase_02 AC 100 ms
91,796 KB
testcase_03 AC 108 ms
91,632 KB
testcase_04 AC 99 ms
91,644 KB
testcase_05 AC 103 ms
99,684 KB
testcase_06 WA -
testcase_07 AC 102 ms
91,532 KB
testcase_08 AC 87 ms
86,756 KB
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 AC 101 ms
97,596 KB
testcase_14 AC 149 ms
99,836 KB
testcase_15 AC 94 ms
91,632 KB
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

n = int(input())
m = 10**6+1
s = [False]*m
for i in map(int, input().split()):
    s[i] = True
dp = [0]*m
mx = 0
for i in range(1, m)[::-1]:
    if i*2**mx >= m:
        break
    if not s[i]:
        continue
    dp[i] = 1
    for j in range(i+i, m, i):
        if j*2**(dp[i]-1) >= m:
            break
        if s[j]:
            dp[i] = max(dp[i], 1+dp[j])
    mx = max(mx, dp[i])
print(mx)
0