結果

問題 No.390 最長の数列
ユーザー tomeruntomerun
提出日時 2016-07-17 03:27:15
言語 Ruby
(3.3.0)
結果
RE  
実行時間 -
コード長 199 bytes
コンパイル時間 64 ms
コンパイル使用メモリ 7,424 KB
実行使用メモリ 29,312 KB
最終ジャッジ日時 2024-04-23 14:53:02
合計ジャッジ時間 3,857 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 109 ms
12,928 KB
testcase_01 AC 97 ms
12,928 KB
testcase_02 AC 104 ms
12,800 KB
testcase_03 AC 106 ms
12,800 KB
testcase_04 AC 107 ms
12,928 KB
testcase_05 RE -
testcase_06 RE -
testcase_07 AC 98 ms
12,928 KB
testcase_08 RE -
testcase_09 RE -
testcase_10 RE -
testcase_11 RE -
testcase_12 RE -
testcase_13 RE -
testcase_14 AC 329 ms
20,224 KB
testcase_15 AC 93 ms
12,800 KB
testcase_16 RE -
testcase_17 RE -
testcase_18 RE -
権限があれば一括ダウンロードができます
コンパイルメッセージ
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