結果

問題 No.672 最長AB列
ユーザー cielciel
提出日時 2018-04-18 00:07:33
言語 Ruby
(3.3.0)
結果
WA  
実行時間 -
コード長 154 bytes
コンパイル時間 178 ms
コンパイル使用メモリ 11,428 KB
実行使用メモリ 25,228 KB
最終ジャッジ日時 2023-09-10 04:37:51
合計ジャッジ時間 3,641 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 84 ms
15,004 KB
testcase_01 AC 83 ms
15,256 KB
testcase_02 AC 84 ms
15,136 KB
testcase_03 AC 82 ms
15,164 KB
testcase_04 WA -
testcase_05 AC 82 ms
15,176 KB
testcase_06 AC 83 ms
15,284 KB
testcase_07 AC 82 ms
15,112 KB
testcase_08 AC 83 ms
15,264 KB
testcase_09 AC 194 ms
25,228 KB
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 AC 155 ms
15,684 KB
testcase_14 WA -
testcase_15 AC 154 ms
15,576 KB
testcase_16 AC 153 ms
15,756 KB
testcase_17 AC 176 ms
20,656 KB
testcase_18 WA -
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

#!/usr/bin/ruby
r=k=0
h={}
gets.chomp.each_char.with_index{|c,i|
	if c=='A'
		k+=1
	else
		k-=1
	end
	if h[k]
		r=[r,i-h[k]].max
	else
		h[k]=i
	end
}
p r
0