結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 79 ms
78,104 KB
testcase_01 AC 78 ms
71,260 KB
testcase_02 AC 80 ms
71,460 KB
testcase_03 AC 93 ms
76,476 KB
testcase_04 AC 96 ms
76,324 KB
testcase_05 AC 106 ms
77,212 KB
testcase_06 AC 149 ms
77,064 KB
testcase_07 AC 337 ms
77,064 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 i >> 2 * n & 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