結果

問題 No.921 ずんだアロー
ユーザー wipexwipex
提出日時 2019-12-22 17:03:42
言語 Ruby
(3.2.2)
結果
AC  
実行時間 139 ms / 2,000 ms
コード長 175 bytes
コンパイル時間 256 ms
コンパイル使用メモリ 11,244 KB
実行使用メモリ 22,812 KB
最終ジャッジ日時 2023-10-12 11:01:43
合計ジャッジ時間 5,102 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 79 ms
15,252 KB
testcase_01 AC 79 ms
15,112 KB
testcase_02 AC 78 ms
15,076 KB
testcase_03 AC 79 ms
15,160 KB
testcase_04 AC 79 ms
15,024 KB
testcase_05 AC 80 ms
15,196 KB
testcase_06 AC 81 ms
15,164 KB
testcase_07 AC 80 ms
15,252 KB
testcase_08 AC 79 ms
15,160 KB
testcase_09 AC 79 ms
15,144 KB
testcase_10 AC 127 ms
21,336 KB
testcase_11 AC 135 ms
22,360 KB
testcase_12 AC 90 ms
16,524 KB
testcase_13 AC 116 ms
19,844 KB
testcase_14 AC 121 ms
20,696 KB
testcase_15 AC 103 ms
18,584 KB
testcase_16 AC 83 ms
15,376 KB
testcase_17 AC 118 ms
20,976 KB
testcase_18 AC 136 ms
22,752 KB
testcase_19 AC 135 ms
22,672 KB
testcase_20 AC 139 ms
22,812 KB
testcase_21 AC 135 ms
22,680 KB
testcase_22 AC 135 ms
22,656 KB
testcase_23 AC 135 ms
22,780 KB
testcase_24 AC 136 ms
22,668 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

N = gets.to_i
a = gets.split(" ").map(&:to_i)
dp = Array.new(100,0)

N.times do |i|
 m = 0
 m = dp[i] if a[i-1]==a[i]
 m =  [m,dp[i-1]].max if i>1
 dp[i+1] = m+1
end

p dp[N]
0