//https://github.com/aoapc-book/aoapc-bac2nd/blob/master/ch7/UVa1354.cpp
// UVa1354 Mobile Computing
// Rujia Liu
#include
#include
#include
using namespace std;
struct Tree {
double L, R; // distance from the root to the leftmost/rightmost point
Tree():L(0),R(0) {}
};
const int maxn = 6;
int n, vis[1< tree[1< r
if(t.L + t.R < r) tree[subset].push_back(t);
}
}
if(!have_children) tree[subset].push_back(Tree());
}
int main() {
int T;
scanf("%d", &T);
// T组输入
while(T--) {
//房间宽度 r 吊坠数目n
scanf("%lf%d", &r, &n);
//第i个吊坠重量w[i]
for(int i = 0; i < n; i++) scanf("%lf", &w[i]);
/*
(1< 1111...11(共n位的1)
sum[i] 表示i对应的二进制数(每个置位的位都代表着一个吊坠)的重量,
方便后面计算的时候查表。
比如n为4,左边挂吊坠的表示为1101, 右边为0010,即左边挂了第0,2,
3个吊坠,右边挂了第1个吊坠。
*/
for(int i = 0; i < (1<