//UVa1149 - Bin Packing
//贪心,背包,乘船问题
#include<iostream>
#include<algorithm>
using namespace std;
int a[101000]; //bag
int main(){
//freopen("UVa1149.in","r",stdin);
int t,n,m;
cin>>t;
while(t--){
cin>>n>>m;
for(int i=0;i<n;i++) cin>>a[i];
sort(a,a+n);
int left=0, right=n-1, ans = 0;
while(left <= right){
if(a[right]+a[left] > m) --right;
else --right, ++left;
++ans;
}
cout<<ans<<"\n";
if(t)cout<<"\n";
}
return 0;
}
//已AC
转载于:https://www.cnblogs.com/gwj1314/p/9444920.html