-
Notifications
You must be signed in to change notification settings - Fork 28
/
fashion.cpp
53 lines (46 loc) · 886 Bytes
/
fashion.cpp
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
41
42
43
44
45
46
47
48
49
50
51
52
53
#include <algorithm>
#include <cctype>
#include <climits>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <string>
#include <vector>
#define inf 1000000000
using namespace std;
int main()
{
cin.sync_with_stdio(false);
int t;
cin >> t;
for (int qwertz = 0; qwertz < t; ++qwertz)
{
int n;
cin >> n;
int x[n], y[n];
for (int j = 0; j < n; ++j)
{
cin >> x[j];
}
for (int j = 0; j < n; ++j)
{
cin >> y[j];
}
sort(x, x+n);
sort(y, y+n);
int sum = 0;
for (int i = 0; i < n; ++i)
{
sum += x[i] * y[i];
}
cout << sum << endl;
}
return 0;
}