結果

問題 No.3210 Fixed Sign Sequense
ユーザー detteiuu
提出日時 2025-07-25 21:25:49
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 59 ms / 2,000 ms
コード長 247 bytes
コンパイル時間 379 ms
コンパイル使用メモリ 82,300 KB
実行使用メモリ 65,532 KB
最終ジャッジ日時 2025-07-25 21:25:56
合計ジャッジ時間 3,660 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 38
権限があれば一括ダウンロードができます

ソースコード

diff #

N = int(input())
S = input()

ans = S.count("-")
cnt1 = 0
cnt2 = S.count("+")
for i in range(N):
    if S[i] == "+":
        cnt2 -= 1
    if S[i] in ["0", "+"]:
        ans = max(ans, cnt1+cnt2+1)
    if S[i] == "-":
        cnt1 += 1

print(ans)
0