配方
You cannot submit for this problem because the contest is ended. You can click "Open in Problem Set" to view this problem in normal mode.
题目描述
超市中有 种食材,分别标号为 ,其中购买第 种食材需要花费 。
小 Z 需要购买其中的一些食材来满足当天的烹饪需求,具体地,他要求每个 中的数 ,都可以选择一些购买过的食材,使得这些食材编号的异或和为 。更详细的解释可以参看样例解释 1。
小 Z 想知道他至少需要花费多少才能满足他的要求。
输入格式
第一行包含一个正整数 。
第二行包含 个正整数 ,含义如上。
输出格式
输出一行一个正整数表示答案。
样例 #1
样例输入 #1
3
3 2 4 7 1 5 8
样例输出 #1
6
提示
样例解释 1
可以购买编号为 的三种食材,共花费 ,这样:
选择的食材编号 | |
---|---|
即可表示出所有 中的数。
样例输入/输出 2
详见下发文件下的 ex_recipe2.in/out。
ex_recipe1.in
ex_recipe1.out
ex_recipe2.in
ex_recipe2.out
这个数据满足第 个测试点的限制。
数据规模与约定
对所有数据,保证 。
测试点编号 | ||
---|---|---|
1121
- Status
- Done
- Rule
- OI
- Problem
- 4
- Start at
- 2024-11-21 14:00
- End at
- 2024-11-21 18:30
- Duration
- 4.5 hour(s)
- Host
- Partic.
- 24