結果
| 問題 |
No.790 ちきんの括弧並べ
|
| ユーザー |
|
| 提出日時 | 2022-02-06 16:29:17 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 421 bytes |
| コンパイル時間 | 273 ms |
| コンパイル使用メモリ | 82,176 KB |
| 実行使用メモリ | 82,688 KB |
| 最終ジャッジ日時 | 2024-06-11 13:47:13 |
| 合計ジャッジ時間 | 4,860 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | -- * 3 |
| other | AC * 8 TLE * 1 -- * 1 |
ソースコード
N = int(input())
from itertools import permutations,accumulate
from functools import reduce
def popcnt(x):
return bin(x)[2:].count('1')
ans = 0
for i in range(1<<(2*N)):
if popcnt(i) != N:
continue
cnd = []
for j in range(2*N):
if (i>>j)&1:
cnd.append(1)
else:
cnd.append(-1)
if min(accumulate(cnd)) == 0:
ans += 1
print(ans)