結果

問題 No.390 最長の数列
ユーザー nebukuro09nebukuro09
提出日時 2016-10-15 10:00:32
言語 PyPy2
(7.3.15)
結果
AC  
実行時間 814 ms / 5,000 ms
コード長 291 bytes
コンパイル時間 2,244 ms
コンパイル使用メモリ 76,712 KB
実行使用メモリ 104,664 KB
最終ジャッジ日時 2024-04-10 10:12:15
合計ジャッジ時間 6,869 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 74 ms
75,692 KB
testcase_01 AC 73 ms
75,536 KB
testcase_02 AC 76 ms
75,684 KB
testcase_03 AC 71 ms
75,308 KB
testcase_04 AC 68 ms
75,400 KB
testcase_05 AC 156 ms
104,144 KB
testcase_06 AC 814 ms
104,328 KB
testcase_07 AC 76 ms
75,680 KB
testcase_08 AC 131 ms
93,728 KB
testcase_09 AC 177 ms
93,892 KB
testcase_10 AC 273 ms
104,632 KB
testcase_11 AC 284 ms
104,664 KB
testcase_12 AC 276 ms
104,444 KB
testcase_13 AC 322 ms
100,988 KB
testcase_14 AC 181 ms
91,588 KB
testcase_15 AC 79 ms
77,596 KB
testcase_16 AC 135 ms
93,880 KB
testcase_17 AC 151 ms
94,036 KB
testcase_18 AC 152 ms
94,540 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N = input()
x = sorted(map(int, raw_input().split()))

m = max(x)
dp = [float('-inf') for _ in xrange(m+1)]
for a in x:
    dp[a] = 1

for a in x:
    b = a*2
    c = dp[a]
    while b <= m:
        if dp[b] != float('-inf'):
            dp[b] = max(c+1, dp[b])
        b += a

print max(dp)
0