結果

問題 No.790 ちきんの括弧並べ
ユーザー MayimgMayimg
提出日時 2019-02-22 08:05:26
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
TLE  
(最新)
AC  
(最初)
実行時間 -
コード長 383 bytes
コンパイル時間 1,888 ms
コンパイル使用メモリ 197,604 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-08-14 16:39:32
合計ジャッジ時間 5,535 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,376 KB
testcase_01 AC 2 ms
4,380 KB
testcase_02 AC 2 ms
4,376 KB
testcase_03 AC 1 ms
4,380 KB
testcase_04 AC 2 ms
4,376 KB
testcase_05 AC 3 ms
4,376 KB
testcase_06 AC 7 ms
4,380 KB
testcase_07 AC 28 ms
4,380 KB
testcase_08 AC 494 ms
4,380 KB
testcase_09 TLE -
testcase_10 AC 1 ms
4,376 KB
testcase_11 AC 1 ms
4,380 KB
testcase_12 AC 114 ms
4,380 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
using namespace std;
signed main() {
	ios::sync_with_stdio(false); cin.tie(0);
	int n;
	cin >> n;
	int ans = 0;
	for (int i = 0; i < (1 << 2 * n); i++) {
		int c = 0, cc = 0;
		for (int j = 0; j < 2 * n; j++) {
			c += (i >> j) & 1 ? 1 : -1;
			cc = min(c, cc);
		}
		ans += cc == 0 && c == 0;
	}
	cout << ans << endl;
	return 0;	
}
0