링크 : https://www.acmicpc.net/problem/1026
#include <iostream>
#include <vector>
#include <algorithm>
#include <functional>
using namespace std;
int main(){
int N = 0;
cin >> N;
vector<int> A;
vector<int> B;
for(int i = 0; i < N; i++){
int a = 0;
cin >> a;
A.push_back(a);
}
for(int i = 0; i < N; i++){
int b = 0;
cin >> b;
B.push_back(b);
}
sort(A.begin(), A.end());
sort(B.begin(), B.end(), greater<int>());
int sum = 0;
for(int i = 0; i < N; i++){
sum += A[i] * B[i];
}
cout << sum;
return 0;
}