結果

問題 No.790 ちきんの括弧並べ
ユーザー yomo3
提出日時 2020-04-05 02:24:53
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
WA  
実行時間 -
コード長 344 bytes
コンパイル時間 83 ms
コンパイル使用メモリ 12,544 KB
実行使用メモリ 18,604 KB
最終ジャッジ日時 2024-07-03 07:55:34
合計ジャッジ時間 1,325 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2 WA * 1
other AC * 1 WA * 9
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
sys.setrecursionlimit(10**5)

N = int(input())

uniq = set()

def solve(n, s=""):
    if n == N:
        uniq.add(s)
        return

    if len(s) == 0:
        solve(n+1, "()")
    else:
        solve(n+1, "(" + s + ")")
        solve(n+1, s + "()")
        if s != "()":
            solve(n+1, "()" + s)

solve(0)

print(len(uniq))
0