My issue
which test case is failing here?
My code
#include <bits/stdc++.h>
#include<algorithm>
using namespace std;
int main() {
// your code goes here
int t,n,x;
cin>>t;
while(t--){
cin>>n>>x;
int arr[n];
int brr[n];
int sum=0,it=0;
for(int i=0;i<n;i++) cin>>arr[i];
for(int i=0;i<n;i++) cin>>brr[i];
int a[n];
for(int i=0;i<n;i++) a[i]=arr[i]*brr[i];
sort(a,a+n);
for(int i=n-1;i>=0;i--){
sum=sum+a[i];
it+=1;
if(sum>=x) {
cout<<it<<endl;
break;
}
}
if (it==n-1) cout<<-1<<endl;
}
}
Problem Link: Minimum Types Practice Coding Problem