-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTrianglesOnRectangle.cpp
More file actions
42 lines (36 loc) · 848 Bytes
/
TrianglesOnRectangle.cpp
File metadata and controls
42 lines (36 loc) · 848 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
36
37
38
39
40
#include<bits/stdc++.h>
using namespace std;
#define fer(i,a,b) for(re i = a; i<b; ++i)
#define re register int
#define pb push_back
#define ll long long
#define mod 1000000007
using namespace std;
typedef vector<int> vi;
typedef pair<int,int> pi;
int main(){
ios_base::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
#ifndef ONLINE_JUDGE
freopen("input.txt", "r", stdin);
freopen("output.txt", "w", stdout);
#endif
int tc;
cin>>tc;
while(tc--){
ll n,k;
cin>>n>>k;
ll arr[4];
for(int i=0;i<4;i++){
ll p; cin>>p;
ll temp[p];
for(int j=0;j<p;j++){
cin>>temp[j];
}
arr[i]=temp[p-1]-temp[0];
}
cout<<max(max(arr[0]*k,arr[1]*k),max(arr[2]*n,arr[3]*n))<<endl;
}
return 0;
}