結果

問題 No.2035 Tunnel
ユーザー 👑 tamatotamato
提出日時 2022-08-12 21:35:25
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 54 ms / 2,000 ms
コード長 382 bytes
コンパイル時間 212 ms
コンパイル使用メモリ 81,804 KB
実行使用メモリ 73,344 KB
最終ジャッジ日時 2023-10-24 08:38:57
合計ジャッジ時間 2,655 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 42 ms
53,296 KB
testcase_01 AC 41 ms
53,296 KB
testcase_02 AC 40 ms
53,296 KB
testcase_03 AC 38 ms
53,296 KB
testcase_04 AC 38 ms
53,296 KB
testcase_05 AC 48 ms
60,208 KB
testcase_06 AC 51 ms
64,308 KB
testcase_07 AC 53 ms
73,344 KB
testcase_08 AC 49 ms
60,256 KB
testcase_09 AC 45 ms
60,256 KB
testcase_10 AC 45 ms
60,196 KB
testcase_11 AC 51 ms
64,092 KB
testcase_12 AC 54 ms
72,588 KB
testcase_13 AC 46 ms
61,348 KB
testcase_14 AC 48 ms
61,348 KB
testcase_15 AC 50 ms
62,096 KB
testcase_16 AC 47 ms
59,848 KB
testcase_17 AC 44 ms
59,292 KB
testcase_18 AC 46 ms
61,348 KB
testcase_19 AC 47 ms
61,348 KB
testcase_20 AC 49 ms
64,092 KB
testcase_21 AC 44 ms
59,288 KB
testcase_22 AC 45 ms
61,340 KB
testcase_23 AC 43 ms
59,288 KB
testcase_24 AC 45 ms
59,732 KB
testcase_25 AC 46 ms
59,856 KB
testcase_26 AC 46 ms
59,816 KB
testcase_27 AC 50 ms
64,188 KB
testcase_28 AC 45 ms
59,288 KB
testcase_29 AC 44 ms
59,288 KB
testcase_30 AC 44 ms
59,288 KB
権限があれば一括ダウンロードができます

ソースコード

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