結果
問題 | No.790 ちきんの括弧並べ |
ユーザー |
![]() |
提出日時 | 2019-05-19 20:19:41 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 1,378 ms / 2,000 ms |
コード長 | 511 bytes |
コンパイル時間 | 1,512 ms |
コンパイル使用メモリ | 166,060 KB |
実行使用メモリ | 6,944 KB |
最終ジャッジ日時 | 2024-09-17 06:32:41 |
合計ジャッジ時間 | 3,871 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 10 |
ソースコード
#include <bits/stdc++.h> using namespace std; int main(){ cin.tie(nullptr); ios::sync_with_stdio(false); int n, ans = 0; cin >> n; n *= 2; // 0:(, 1:) for(int i = 0; i < (1 << n); i++){ bool f = true; int zero = 0, one = 0; for(int j = 0; j < n; j++){ if((i >> j) & 1) one++; else zero++; if(zero < one){f = false; break;} } if(f and zero == one) ans++; } cout << ans << endl; return 0; }