I have solve the same question without using an Array ,is it okay to solve?

int main() {
int test_cases;
cin>>test_cases;
while(test_cases!=0)
{
int c1,c2,c3,c4;
cin>>c1>>c2>>c3>>c4;
int n,m,t,sum1=0,sum2=0;
cin>>n>>m;
while(n!=0)
{
cin>>t;
sum1+=(tc1)>c2?c2:(tc1);
n–;
}
sum1=c3>sum1?sum1:c3;
while(m!=0)
{
cin>>t;
sum2+=(tc1)>c2?c2:(tc1);
m–;
}
sum2=c3>sum2?sum2:c3;
int result=(sum1+sum2)>c4?c4:(sum1+sum2);
cout<<result<<endl;
test_cases–;
}
return 0;
}

@Nidhi_Alipuria
Your solution is working perfectly fine. Using an array makes it easier to solve however there is no problem with your code either. If anything , its actually better as we are able to save space using this approach. Well done.