結果

問題 No.790 ちきんの括弧並べ
ユーザー pasoconhoshiipasoconhoshii
提出日時 2019-02-20 22:51:12
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 330 bytes
コンパイル時間 602 ms
コンパイル使用メモリ 82,432 KB
実行使用メモリ 82,304 KB
最終ジャッジ日時 2024-04-25 10:53:04
合計ジャッジ時間 6,866 ms
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 49 ms
58,624 KB
testcase_01 AC 61 ms
62,464 KB
testcase_02 AC 77 ms
70,784 KB
testcase_03 AC 123 ms
78,336 KB
testcase_04 AC 141 ms
76,928 KB
testcase_05 AC 215 ms
77,440 KB
testcase_06 AC 536 ms
77,568 KB
testcase_07 AC 1,842 ms
78,080 KB
testcase_08 TLE -
testcase_09 -- -
testcase_10 -- -
testcase_11 -- -
testcase_12 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

N = int(input())

from copy import copy
from itertools import accumulate

ans = 0
for S in range(1<<2*N):
    b = format(S, 'b').zfill(2*N)
    b = list(map(int, list(b)))
    b = list(map(lambda x: x if x == 1 else -1, b))
    ac = list(accumulate(b))

    if all(x >= 0 for x in ac) and ac[-1] == 0:
        ans += 1

print(ans)
0