結果

問題 No.390 最長の数列
ユーザー tomeruntomerun
提出日時 2016-07-17 03:28:56
言語 Ruby
(3.3.0)
結果
AC  
実行時間 1,283 ms / 5,000 ms
コード長 201 bytes
コンパイル時間 39 ms
コンパイル使用メモリ 7,552 KB
実行使用メモリ 28,032 KB
最終ジャッジ日時 2024-04-10 09:12:10
合計ジャッジ時間 6,703 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 253 ms
20,096 KB
testcase_01 AC 162 ms
19,968 KB
testcase_02 AC 229 ms
19,968 KB
testcase_03 AC 177 ms
20,224 KB
testcase_04 AC 237 ms
20,096 KB
testcase_05 AC 161 ms
28,032 KB
testcase_06 AC 1,165 ms
27,904 KB
testcase_07 AC 159 ms
19,968 KB
testcase_08 AC 87 ms
20,096 KB
testcase_09 AC 154 ms
20,224 KB
testcase_10 AC 279 ms
28,032 KB
testcase_11 AC 278 ms
28,032 KB
testcase_12 AC 293 ms
27,904 KB
testcase_13 AC 368 ms
26,240 KB
testcase_14 AC 1,283 ms
28,032 KB
testcase_15 AC 88 ms
19,968 KB
testcase_16 AC 84 ms
20,096 KB
testcase_17 AC 96 ms
19,968 KB
testcase_18 AC 99 ms
20,224 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
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(1000001, -1)
x.each { |i| c[i] = 1 }

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

puts c.max
0