it is showing correct answer as per the sample input when i run code but after submitting the code, it is saying wrong answer even though my code is correct. the code is shared below.
#include
using namespace std;
int min(int a,int b)
{
if(a<b)
{
return a;
}
else if(b<a)
{
return b;
}
}
int main()
{
int t;
cin>>t;
while(t>0)
{
int c1,c2,c3,c4;
cin>>c1>>c2>>c3>>c4;
int n,m,i,rickcost=0,cabcost=0,totalcost;
cin>>n>>m;
int rick[n],cab[m];
for(i=0;i<n;i++)
{
cin>>rick[i];
}
for(i=0;i<m;i++)
{
cin>>cab[i];
}
for(i=0;i<n;i++)
{
rickcost+=min((c1*rick[i]),c2);
}
rickcost=min(rickcost,c3);
for(i=0;i<m;i++)
{
cabcost+=min((c1*cab[i]),c2);
}
cabcost=min(cabcost,c3);
int p=rickcost+cabcost;
totalcost=min(p,c4);
cout<<totalcost<<endl;
t--;
}
return 0;
}