結果

問題 No.790 ちきんの括弧並べ
ユーザー Navier_Boltzmann
提出日時 2022-02-06 16:29:17
言語 PyPy3
(7.3.17)
コンパイル:
pypy3 -mpy_compile _filename_
実行:
pypy3 _filename_
結果
TLE  
実行時間 -
コード長 421 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 242 ms
コンパイル使用メモリ 85,336 KB
実行使用メモリ 163,964 KB
最終ジャッジ日時 2026-03-04 15:01:32
合計ジャッジ時間 8,779 ms
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 8 TLE * 2
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

N = int(input())
from itertools import permutations,accumulate
from functools import reduce

def popcnt(x):
    return bin(x)[2:].count('1')

ans = 0
for i in range(1<<(2*N)):
    if popcnt(i) != N:
        continue
    
    cnd = []
    for j in range(2*N):
        if (i>>j)&1:
            cnd.append(1)
        else:
            cnd.append(-1)
            
    if min(accumulate(cnd)) == 0:
        ans += 1
print(ans)
0