結果

問題 No.390 最長の数列
ユーザー tomerun
提出日時 2016-07-17 03:27:15
言語 Ruby
(3.4.1)
結果
RE  
実行時間 -
コード長 199 bytes
コンパイル時間 56 ms
コンパイル使用メモリ 7,552 KB
実行使用メモリ 29,184 KB
最終ジャッジ日時 2024-10-15 15:13:14
合計ジャッジ時間 3,618 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 4 RE * 11
権限があれば一括ダウンロードができます
コンパイルメッセージ
Main.rb:1: warning: assigned but unused variable - n
Syntax OK

ソースコード

diff #

n = gets.to_i
x = gets.split.map(&:to_i).sort
c = Array.new(100001, -1)
x.each { |i| c[i] = 1 }

x.each { |i|
	(2*i).step(100000, i) { |j|
		c[j] = [c[j], c[i] + 1].max if c[j] >= 0
	}
}

puts c.max
0