Problem - F - Codeforces 24
Check the editorial for this problem, it’s from a previous codeforces round
2 Likes
I am trying to solve it using the editorial of Codeforces Problem. But one more solution that is getting AC is something like
sort(arr,arr+n,greater<pp>());
pp ans = LLONG_MIN;
for(pp i=0;i<min(n,50ll);i++)
{
for(pp j=i+1;j<n;j++)
{
ans = max(ans, (arr[i]*arr[j])/(__gcd(arr[i],arr[j])));
}
}
cout<<ans<<"\n";
That using of i<min(n,50ll) I wanted to know how this method is giving correct solution. Some of the solutions uses this logic and I want to know the intuition behind this.
@everule1 @vijju123 @taran_1407. If anyone could help.