結果
問題 |
No.790 ちきんの括弧並べ
|
ユーザー |
|
提出日時 | 2020-04-05 03:24:05 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 494 ms / 2,000 ms |
コード長 | 448 bytes |
コンパイル時間 | 1,559 ms |
コンパイル使用メモリ | 167,012 KB |
実行使用メモリ | 6,944 KB |
最終ジャッジ日時 | 2024-07-03 07:58:00 |
合計ジャッジ時間 | 2,689 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 10 |
ソースコード
#include <bits/stdc++.h> using namespace std; int main() { int N; cin >> N; int ans = 0; for (int b = 0; b < (1 << (2 * N)); b++) { if (__builtin_popcount(b) != N) continue; int c = 0; for (int i = 0; i < 2*N; i++) { if (b & (1 << i)) { if (--c < 0) break; } else { c++; } } if (c == 0) ans++; } cout << ans << endl; }