結果

問題 No.2035 Tunnel
ユーザー tamato
提出日時 2022-08-12 21:35:25
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 54 ms / 2,000 ms
コード長 382 bytes
コンパイル時間 157 ms
コンパイル使用メモリ 82,052 KB
実行使用メモリ 73,780 KB
最終ジャッジ日時 2024-09-23 01:18:10
合計ジャッジ時間 2,512 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 28
権限があれば一括ダウンロードができます

ソースコード

diff #

mod = 998244353


def main():
    import sys
    input = sys.stdin.readline

    N = int(input())
    S = "." + input().rstrip('\n')

    cnt = 0
    ans = 0
    for i in range(-1, -N-1, -1):
        if S[i] == "#":
            cnt += 1
            ans = max(ans, -i + cnt - 1)
        else:
            cnt = max(0, cnt - 1)

    print(ans)


if __name__ == '__main__':
    main()
0