Please can anyone tell me what is wrong with the following solution of FASHION in C++.I am getting a wrong answer, though the following code works perfectly in Codeblocks.
include
include
include
using namespace std;
int main(void)
{
int t, n, i, temp;
vector m, f;
cin >> t;
while(t--)
{
unsigned long long sum = 0;
cin >> n;
for(i = 0; i < n; i++)
{
cin >> temp;
m.push_back(temp);
}
for(i = 0; i < n; i++)
{
cin >> temp;
f.push_back(temp);
}
sort(m.begin(),m.end());
sort(f.begin(),f.end());
for(i = 0; i < n; i++)
{
sum = sum + (m[i] * f[i]);
}
cout << sum << endl;
}
return 0;
}