結果

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

ソースコード

diff #

from bisect import*
n=int(input())
s=input()
m=-n
p=1
a=[]
for c in s:
  if c=='+':
    a+=p,
    p+=1
  if c=='-':
    a+=m,
    m+=1
  if c=='0':
    a+=0,
l=[]
for i in range(n):
  j=bisect_left(l,a[i])
  if j<len(l):
    l[j]=a[i]
  else:
    l+=a[i],
print(len(l))
0