結果

問題 No.390 最長の数列
ユーザー simansiman
提出日時 2020-10-28 13:17:42
言語 Ruby
(3.3.0)
結果
WA  
実行時間 -
コード長 243 bytes
コンパイル時間 365 ms
コンパイル使用メモリ 11,308 KB
実行使用メモリ 31,128 KB
最終ジャッジ日時 2023-09-29 03:37:07
合計ジャッジ時間 6,464 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 84 ms
15,032 KB
testcase_01 AC 85 ms
15,244 KB
testcase_02 AC 83 ms
15,252 KB
testcase_03 AC 84 ms
15,248 KB
testcase_04 AC 84 ms
15,032 KB
testcase_05 AC 167 ms
30,972 KB
testcase_06 AC 1,378 ms
30,844 KB
testcase_07 AC 85 ms
15,244 KB
testcase_08 AC 88 ms
23,024 KB
testcase_09 AC 202 ms
22,904 KB
testcase_10 AC 351 ms
31,128 KB
testcase_11 AC 382 ms
30,904 KB
testcase_12 AC 358 ms
30,852 KB
testcase_13 AC 518 ms
28,692 KB
testcase_14 AC 261 ms
23,204 KB
testcase_15 AC 84 ms
15,556 KB
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

N = gets.to_i
X = gets.split.map(&:to_i).sort
M = X.last

dp = Array.new(M + 1, 0)
dp[X.first] = 1
ans = 0

X.each do |x|
  ans = dp[x] if ans < dp[x]

  (2 * x).step(M, x) do |i|
    dp[i] = dp[x] + 1 if dp[i] < dp[x] + 1
  end
end

puts ans
0