結果
問題 |
No.3210 Fixed Sign Sequense
|
ユーザー |
|
提出日時 | 2025-07-25 21:34:26 |
言語 | PyPy3 (7.3.15) |
結果 |
WA
|
実行時間 | - |
コード長 | 424 bytes |
コンパイル時間 | 270 ms |
コンパイル使用メモリ | 82,384 KB |
実行使用メモリ | 76,748 KB |
最終ジャッジ日時 | 2025-07-25 21:34:53 |
合計ジャッジ時間 | 4,207 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 30 WA * 8 |
ソースコード
N = int(input()) S = input() dp = [0] * 3 if S[0] == "-": dp[0] = 1 elif S[0] == "0": dp[1] = 1 else: dp[2] = 1 for s in S[1:]: 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))