結果
| 問題 |
No.3210 Fixed Sign Sequense
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2025-07-27 09:19:06 |
| 言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
| 結果 |
AC
|
| 実行時間 | 239 ms / 2,000 ms |
| コード長 | 251 bytes |
| コンパイル時間 | 205 ms |
| コンパイル使用メモリ | 12,288 KB |
| 実行使用メモリ | 11,136 KB |
| 最終ジャッジ日時 | 2025-07-27 09:19:15 |
| 合計ジャッジ時間 | 8,336 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 38 |
ソースコード
n = int(input())
s = input()
m = 0
p = s.count("+")
ans = max(p, s.count("-"))
for i in range(n):
if s[i] == "-":
m += 1
elif s[i] == "+":
p -= 1
else:
ans = max(ans, m+p+1)
ans = max(ans, m+p)
print(ans)