結果

問題 No.3210 Fixed Sign Sequense
ユーザー tipstar0125
提出日時 2025-07-25 22:01:15
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 476 bytes
コンパイル時間 378 ms
コンパイル使用メモリ 82,376 KB
実行使用メモリ 86,480 KB
最終ジャッジ日時 2025-07-25 22:01:19
合計ジャッジ時間 3,852 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 14 WA * 24
権限があれば一括ダウンロードができます

ソースコード

diff #

n=int(input())
s=input().split("0")
ans=1

p=0
m=0
for i,si in enumerate(s):
    if len(si)==0:
        ans=max(ans,m+1)
    else:
        np=0
        nm=0
        for sii in si:
            if sii=="-":
                nm+=1
            else:
                np+=1
        ans=max(ans,np)
        ans=max(ans,nm)
        if i==0:
            ans=max(ans,nm)
            ans=max(ans,np)
        else:
            ans=max(ans,m+np+1)
        m=nm
        p=np

    
print(ans)
0