結果

問題 No.790 ちきんの括弧並べ
ユーザー Navier_BoltzmannNavier_Boltzmann
提出日時 2022-02-06 16:28:47
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
TLE  
実行時間 -
コード長 421 bytes
コンパイル時間 78 ms
コンパイル使用メモリ 10,596 KB
実行使用メモリ 13,196 KB
最終ジャッジ日時 2023-09-02 06:59:32
合計ジャッジ時間 6,386 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 20 ms
13,000 KB
testcase_01 AC 20 ms
8,620 KB
testcase_02 AC 21 ms
8,708 KB
testcase_03 AC 24 ms
8,572 KB
testcase_04 AC 40 ms
8,648 KB
testcase_05 AC 104 ms
8,624 KB
testcase_06 AC 366 ms
8,576 KB
testcase_07 AC 1,445 ms
8,652 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