結果

問題 No.790 ちきんの括弧並べ
ユーザー 大橋佐和大橋佐和
提出日時 2022-05-06 19:18:33
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 323 bytes
コンパイル時間 617 ms
コンパイル使用メモリ 86,912 KB
実行使用メモリ 81,672 KB
最終ジャッジ日時 2023-09-19 08:28:23
合計ジャッジ時間 5,363 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 80 ms
78,508 KB
testcase_01 AC 79 ms
71,388 KB
testcase_02 AC 82 ms
71,564 KB
testcase_03 AC 90 ms
76,876 KB
testcase_04 AC 95 ms
76,664 KB
testcase_05 AC 104 ms
77,272 KB
testcase_06 AC 147 ms
77,100 KB
testcase_07 AC 332 ms
77,100 KB
testcase_08 TLE -
testcase_09 -- -
testcase_10 -- -
testcase_11 -- -
testcase_12 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

n = int(input())

a = 0
for i in range(1 << 2 * n):
    if not i & 1:
        continue
    if bin(i).count("1") != n:
        continue
    s = 0
    for j in range(2 * n):
        if i >> j & 1:
            s += 1
        else:
            s -= 1
        if s < 0:
            break
    if s == 0:
        a += 1

print(a)
0