結果

問題 No.3210 Fixed Sign Sequense
ユーザー hidehic0
提出日時 2025-07-25 21:29:05
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 331 bytes
コンパイル時間 407 ms
コンパイル使用メモリ 82,908 KB
実行使用メモリ 76,568 KB
最終ジャッジ日時 2025-07-25 21:29:19
合計ジャッジ時間 4,171 ms
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 30 WA * 8
権限があれば一括ダウンロードができます

ソースコード

diff #

N = int(input())
dp = [0] * 3

for s in input():
    new_dp = dp[:]
    if s == "-":
        new_dp[0] = max(new_dp[0], dp[0] + 1)
    elif s == "0":
        new_dp[1] = max(new_dp[1], dp[0] + 1)
    else:
        new_dp[2] = max(new_dp[2], dp[1] + 1)
        new_dp[2] = max(new_dp[2], dp[2] + 1)

    dp = new_dp

print(max(dp))
0