版本比较
题解:AT_abc464_f [ABC464F] Random Vault Heist
正文
增加 2 行删除 1 行
17 行未改动1819202122222324252677 行未改动10410510610710817 行未改动最后枚举 $l$ 时枚举 $|r|$。设 $t = \sum_{i=1}^n a_i$,大小为 $m$ 的所有集合 $S$ 的 $P(S)$ 为 $p(m)$,则 $l$ 对答案的贡献即:
$$\sum_{i=0}^{|R|} p(|l| + i)((t - \sum_{j \in l} a_j)c_i - s_i)$$
所有贡献相加即得答案。若取 $|L| = \lfloor \frac{n}{2} \rfloor$,时间复杂度为 $O(2^{\frac{n}{2}} n)$,空间复杂度为 $O(2^n)$,足以通过本题。所有贡献相加即得答案。若取 $|L| = \lfloor \frac{n}{2} \rfloor$,时间复杂度为 $O(2^{\frac{n}{2}} n)$,空间复杂度为 $O(2^{\frac{n}{2}})$,足以通过本题。
## 代码```cpp#include <bits/stdc++.h>77 行未改动 } cout << ans << '\n';}```upd on 26/7/1:修复了一处笔误。