-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathHelp_Ramu.cpp
More file actions
35 lines (33 loc) · 774 Bytes
/
Help_Ramu.cpp
File metadata and controls
35 lines (33 loc) · 774 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
// @author: Abhimanyu Maurya
#include <iostream>
using namespace std;
#ifndef ONLINE_JUDGE
FILE *fr = freopen("input.txt", "r", stdin);
FILE *fw = freopen("output.txt", "w", stdout);
#endif
int main()
{
int test, c1, c2, c3, c4, r, c, rcost, ccost, t;
cin >> test;
while (test--)
{
cin >> c1 >> c2 >> c3 >> c4;
cin >> r >> c;
int tmpres = 0;
for (int i = 0; i < r; i++)
{
cin >> t;
tmpres += min(t * c1, c2);
}
rcost = min(tmpres, c3);
tmpres = 0;
for (int i = 0; i < c; i++)
{
cin >> t;
tmpres += min(t * c1, c2);
}
ccost = min(tmpres, c3);
cout << min(ccost + rcost, c4) << "\n";
}
return 0;
}