結果
| 問題 |
No.672 最長AB列
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2018-04-13 23:52:05 |
| 言語 | Ruby (3.4.1) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 257 bytes |
| コンパイル時間 | 275 ms |
| コンパイル使用メモリ | 7,424 KB |
| 実行使用メモリ | 38,784 KB |
| 最終ジャッジ日時 | 2024-06-27 19:55:51 |
| 合計ジャッジ時間 | 4,780 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 6 TLE * 1 -- * 9 |
コンパイルメッセージ
Syntax OK
ソースコード
S = gets.chomp.chars
A = [sum = 0]+S.map{|c|sum += c == ?A ? 1 : 0}
B = [sum = 0]+S.map{|c|sum += c == ?B ? 1 : 0}
ans = 0
(0...A.size).each{|l|
(l...A.size).each{|r|
if A[r] - A[l] == B[r] - B[l]
ans = r - l if r - l > ans
end
}
}
p ans