結果

問題 No.790 ちきんの括弧並べ
ユーザー tails1434tails1434
提出日時 2020-01-09 21:58:59
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 541 bytes
コンパイル時間 241 ms
コンパイル使用メモリ 82,560 KB
実行使用メモリ 81,152 KB
最終ジャッジ日時 2024-05-02 14:31:32
合計ジャッジ時間 4,737 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 36 ms
56,832 KB
testcase_01 AC 38 ms
51,968 KB
testcase_02 AC 38 ms
53,632 KB
testcase_03 AC 53 ms
64,768 KB
testcase_04 AC 61 ms
73,216 KB
testcase_05 AC 82 ms
76,032 KB
testcase_06 AC 156 ms
76,160 KB
testcase_07 AC 478 ms
76,032 KB
testcase_08 TLE -
testcase_09 -- -
testcase_10 -- -
testcase_11 -- -
testcase_12 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

def main():
    N = int(input())
    cnt = 0
    for i in range(1<<(N * 2)):
        bin_num = bin(i)[2:]
        if bin_num.count('1') != N:
            continue 
        left = 0
        right = 0
        flag = True
        for j in range(N * 2):
            if (i >> j) & 1:
                left += 1
            else:
                right += 1

            if right > left:
                flag = False
                break
        if flag and right == left:
            cnt += 1

    print(cnt)

if __name__ == "__main__":
    main()
0