結果

問題 No.790 ちきんの括弧並べ
ユーザー Navier_BoltzmannNavier_Boltzmann
提出日時 2022-02-06 16:29:17
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 421 bytes
コンパイル時間 282 ms
コンパイル使用メモリ 86,828 KB
実行使用メモリ 82,748 KB
最終ジャッジ日時 2023-09-02 06:59:38
合計ジャッジ時間 5,720 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 103 ms
76,844 KB
testcase_01 AC 104 ms
72,416 KB
testcase_02 AC 113 ms
77,800 KB
testcase_03 AC 122 ms
77,992 KB
testcase_04 AC 129 ms
78,556 KB
testcase_05 AC 150 ms
78,248 KB
testcase_06 AC 245 ms
78,200 KB
testcase_07 AC 661 ms
78,376 KB
testcase_08 TLE -
testcase_09 -- -
testcase_10 -- -
testcase_11 -- -
testcase_12 -- -
権限があれば一括ダウンロードができます

ソースコード

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