結果

問題 No.790 ちきんの括弧並べ
ユーザー CELICA
提出日時 2020-09-06 09:06:27
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 1,843 ms / 2,000 ms
コード長 426 bytes
コンパイル時間 1,495 ms
コンパイル使用メモリ 165,336 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2024-11-29 06:40:22
合計ジャッジ時間 4,721 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 10
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>

using namespace std;

using ll = long long;
using ul = unsigned long;

int main()
{
	ios::sync_with_stdio(false);
	cin.tie(nullptr);

	int n;
	cin >> n;

	ll nn{ n * 2 }, res{ 0 };

	for (ll i = 0; i < (1 << nn); ++i)
	{
		int o{ 0 }, c{ 0 };

		for (int j = 0; j < nn; ++j)
		{
			i& (1 << j) ? ++o : ++c;
			if (o < c)
				break;
		}

		if (o == c)
			++res;
	}

	cout << res << "\n";

	return 0;
}
0