結果

問題 No.127 門松もどき
ユーザー 👑 hos.lyrichos.lyric
提出日時 2015-01-30 15:06:52
言語 Ruby
(3.3.0)
結果
AC  
実行時間 1,361 ms / 5,000 ms
コード長 242 bytes
コンパイル時間 226 ms
コンパイル使用メモリ 11,564 KB
実行使用メモリ 156,572 KB
最終ジャッジ日時 2023-08-25 13:58:13
合計ジャッジ時間 17,242 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 71 ms
15,564 KB
testcase_01 AC 70 ms
15,844 KB
testcase_02 AC 70 ms
15,812 KB
testcase_03 AC 70 ms
15,344 KB
testcase_04 AC 1,361 ms
156,376 KB
testcase_05 AC 70 ms
15,176 KB
testcase_06 AC 192 ms
54,736 KB
testcase_07 AC 75 ms
18,876 KB
testcase_08 AC 71 ms
17,140 KB
testcase_09 AC 75 ms
16,676 KB
testcase_10 AC 71 ms
16,468 KB
testcase_11 AC 81 ms
22,208 KB
testcase_12 AC 759 ms
117,596 KB
testcase_13 AC 968 ms
133,752 KB
testcase_14 AC 896 ms
128,460 KB
testcase_15 AC 1,183 ms
148,724 KB
testcase_16 AC 867 ms
126,764 KB
testcase_17 AC 973 ms
135,188 KB
testcase_18 AC 839 ms
124,484 KB
testcase_19 AC 542 ms
100,432 KB
testcase_20 AC 550 ms
101,616 KB
testcase_21 AC 316 ms
73,896 KB
testcase_22 AC 1,315 ms
156,572 KB
testcase_23 AC 1,325 ms
156,380 KB
testcase_24 AC 1,056 ms
138,628 KB
testcase_25 AC 1,279 ms
149,668 KB
testcase_26 AC 637 ms
109,380 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

n=gets.to_i+1
a=[0]+gets.split.map(&:to_i)+[0]
l=(0..n).map{[0]*3005}
r=(0..n).map{[0]*3005}
(1..n).each{|w|(0..n-w).each{|i|y=r[w-1][i];l[w][i]=[x=l[w-1][i+1],a[i]>a[i+w]?y+1:0].max;r[w][i]=[y,a[i]<a[i+w]?x+1:0].max}}
p [l[n][0],r[n][0]].max
0