結果

問題 No.2035 Tunnel
ユーザー tomerun
提出日時 2022-08-12 22:39:08
言語 Crystal
(1.14.0)
結果
AC  
実行時間 7 ms / 2,000 ms
コード長 210 bytes
コンパイル時間 12,730 ms
コンパイル使用メモリ 295,864 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-09-23 03:17:34
合計ジャッジ時間 13,813 ms
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 28
権限があれば一括ダウンロードができます

ソースコード

diff #

n = read_line.to_i
s = read_line.chars
i = s.index('#').not_nil!
max = 0
cur = 0
(i + 1).upto(n - 1) do |i|
  if s[i] == '#'
    cur += 1
    max = {max, cur}.max
  else
    cur -= 1
  end
end
puts n - i + max
0