question link:
https://hack.codingblocks.com/app/practice/3/715/problem
my code link:
please give me suggestion or rectify my mistake
question link:
https://hack.codingblocks.com/app/practice/3/715/problem
my code link:
please give me suggestion or rectify my mistake
hello @dhruvilcodes
ur solution complexity is O(N^2) per test case.

which is too much for the given values of n.
try to think of O(NLOGN) approach .
for(i=0;i<n;i++)
{
for(j=i+1;j<n;j++)
{
if(i!=j)
{
sum+=abs(a[i]-a[j])*max(b[i],b[j]);
}
}
}
I CHANGED TO THIS STILL I AM NOT GETTING RID OF TLE
it is still N^2.
are u familiar with Binary indexed tree?
if yes then try to think in that direction.
N O SIR EVEN I DO NOT KNOW ABOUT THIS COMPLEXITY THING
ok then leave this problem for now.
learn other rquired stuff and then try it again