Hi, I’ve written the following code and it is working for all the testcases except 1. Kindly help me with this.
#include
using namespace std;
int main() {
int c1,c2,c3,c4;
int T,n,m,ai,bi;
int cost_i_rick = 0;
int cost_i_cab = 0;
int total_rick_cost,total_cab_cost;
int total_min_cost;
cin>>T;
while(T–){
cin>>c1>>c2>>c3>>c4;
cin>>n>>m;
for( int j = 1 ; j<=n ; j++)
{
cin>>ai;
cost_i_rick = min((ai*c1),c2) + cost_i_rick;
}
total_rick_cost = min(cost_i_rick, c3);
for( int k = 1; k<=m; k++)
{
cin>>bi;
cost_i_cab = min((bi*c1), c2) + cost_i_cab;
}
total_cab_cost = min(cost_i_cab, c3);
total_min_cost = min(c4, (total_rick_cost + total_cab_cost)) ;
cout<<total_min_cost<<endl;
}
return 0;
}