結果

問題 No.790 ちきんの括弧並べ
ユーザー Navier_Boltzmann
提出日時 2022-02-06 16:28:47
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
TLE  
実行時間 -
コード長 421 bytes
コンパイル時間 245 ms
コンパイル使用メモリ 12,672 KB
実行使用メモリ 16,000 KB
最終ジャッジ日時 2024-06-11 13:47:08
合計ジャッジ時間 5,982 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample -- * 3
other AC * 8 TLE * 1 -- * 1
権限があれば一括ダウンロードができます

ソースコード

diff #

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