結果

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

ソースコード

diff #

N=int(input())
S=input()
m,p=0,S.count('+') 
ans=max(S.count('+'),S.count('-'))
for s in S:
  if s=='-':
    m+=1
  elif s=='+':
    p-=1
  ans=max(ans,m+p)
  if s=='0':
    ans=max(ans,m+p+1)
print(ans)
    
0