結果

問題 No.390 最長の数列
ユーザー wotsushiwotsushi
提出日時 2016-12-17 09:52:49
言語 Ruby
(3.3.0)
結果
AC  
実行時間 1,241 ms / 5,000 ms
コード長 205 bytes
コンパイル時間 41 ms
コンパイル使用メモリ 7,424 KB
実行使用メモリ 28,032 KB
最終ジャッジ日時 2024-04-10 10:13:38
合計ジャッジ時間 5,030 ms
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 80 ms
12,160 KB
testcase_01 AC 86 ms
12,288 KB
testcase_02 AC 84 ms
12,160 KB
testcase_03 AC 82 ms
12,160 KB
testcase_04 AC 80 ms
12,288 KB
testcase_05 AC 153 ms
27,904 KB
testcase_06 AC 1,241 ms
28,032 KB
testcase_07 AC 79 ms
12,288 KB
testcase_08 AC 86 ms
19,968 KB
testcase_09 AC 193 ms
19,968 KB
testcase_10 AC 298 ms
27,904 KB
testcase_11 AC 318 ms
28,032 KB
testcase_12 AC 311 ms
27,904 KB
testcase_13 AC 471 ms
26,112 KB
testcase_14 AC 280 ms
20,992 KB
testcase_15 AC 77 ms
12,160 KB
testcase_16 AC 82 ms
20,096 KB
testcase_17 AC 90 ms
20,096 KB
testcase_18 AC 96 ms
20,352 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

N = gets.to_i
x = gets.split.map(&:to_i)
m = x.max
dp = Array.new(m + 1, 1)
x.sort.each do |a|
  (2 * a).step(m, a) do |b|
    dp[b] = [dp[b], dp[a] + 1].max
  end
end
ans = x.map {|a| dp[a]}.max
puts ans
0