結果
問題 |
No.790 ちきんの括弧並べ
|
ユーザー |
![]() |
提出日時 | 2019-02-20 22:51:12 |
言語 | PyPy3 (7.3.15) |
結果 |
TLE
|
実行時間 | - |
コード長 | 330 bytes |
コンパイル時間 | 430 ms |
コンパイル使用メモリ | 82,304 KB |
実行使用メモリ | 82,176 KB |
最終ジャッジ日時 | 2024-11-07 21:35:13 |
合計ジャッジ時間 | 7,064 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | -- * 3 |
other | AC * 8 TLE * 1 -- * 1 |
ソースコード
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)