結果

問題 No.390 最長の数列
ユーザー cielciel
提出日時 2016-07-11 19:33:25
言語 Ruby
(3.3.0)
結果
AC  
実行時間 1,373 ms / 5,000 ms
コード長 178 bytes
コンパイル時間 225 ms
コンパイル使用メモリ 7,552 KB
実行使用メモリ 25,728 KB
最終ジャッジ日時 2024-04-10 09:05:50
合計ジャッジ時間 8,382 ms
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 315 ms
19,840 KB
testcase_01 AC 226 ms
20,096 KB
testcase_02 AC 292 ms
20,096 KB
testcase_03 AC 249 ms
20,096 KB
testcase_04 AC 300 ms
20,096 KB
testcase_05 AC 212 ms
25,600 KB
testcase_06 AC 1,287 ms
25,600 KB
testcase_07 AC 226 ms
19,968 KB
testcase_08 AC 155 ms
20,096 KB
testcase_09 AC 231 ms
20,096 KB
testcase_10 AC 321 ms
25,728 KB
testcase_11 AC 350 ms
25,600 KB
testcase_12 AC 326 ms
25,600 KB
testcase_13 AC 438 ms
24,448 KB
testcase_14 AC 1,373 ms
25,600 KB
testcase_15 AC 162 ms
20,096 KB
testcase_16 AC 159 ms
19,968 KB
testcase_17 AC 173 ms
20,096 KB
testcase_18 AC 173 ms
20,224 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

M=1000001
A=[0]*M
gets
gets.split.each{|e|A[e.to_i]=1}
r=0
(1...M).each{|i|
	if A[i]>0
		(i*2).step(M-1,i){|j|
			A[j]=[A[j],A[i]+1].max if A[j]>0
		}
		r=[r,A[i]].max
	end
}
p r
0