-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSorting12.cpp
More file actions
33 lines (31 loc) · 788 Bytes
/
Copy pathSorting12.cpp
File metadata and controls
33 lines (31 loc) · 788 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
#include<iostream>
#include<vector>
#include<algorithm>
int main(){
int t;
int n,m;
std::cin>>t;
while (t--)
{
std::cin >> n;
std::cin >> m;
std::vector<long long>myvector1;
std::vector<long long>myvector2;
long long x;
for(int i=0;i< n;i++){
std::cin >> x;
myvector1.push_back(x);
}
std::sort(myvector1.begin(),myvector1.end());
long long y;
for (int i = 0; i < m; i++)
{
std::cin >> y;
myvector2.push_back(y);
}
std::sort(myvector2.begin(),myvector2.end());
long long res = 0;
res = (myvector1[n-1]) * (myvector2[0]);
std::cout<<res<<std::endl;
}
}