結果

問題 No.3210 Fixed Sign Sequense
ユーザー Foxy_null
提出日時 2025-07-25 22:01:19
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
TLE  
実行時間 -
コード長 669 bytes
コンパイル時間 1,930 ms
コンパイル使用メモリ 194,996 KB
実行使用メモリ 7,716 KB
最終ジャッジ日時 2025-07-25 22:01:37
合計ジャッジ時間 5,118 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other TLE * 1 -- * 37
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;

#define int long long

void testcase()
{
	int N;
	cin >> N;

	string S;
	cin >> S;

	int max_count = 0, count = 0;
	for (int i = 0; i < S.size(); i++)
	{
		bool minus_ok = 0, zero_ok = 0, plus_ok = 0;
		for (int j = i; j < S.size(); j++)
		{
			if (S[j] == '-' && !zero_ok && !plus_ok)
				count++;

			if (S[j] == '0' && !plus_ok)
			{
				count++;
				zero_ok = 1;
			}

			if (S[j] == '+')
			{
				count++;
				plus_ok = 1;
			}
		}
		max_count = max(max_count, count);
		count = 0;
	}

	cout << max_count << '\n';
}

int32_t main()
{
	ios::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);

	testcase();
	return 0;
}
0