PHCUL - Editorial

Thanx for the tip! I will try to figure out a way for this.

Also here is my solution, which I think is cleaner and also slightly optimized for,

Here, distance between the point ‘a’ and ‘b’ is calculated twice which will remain same and thus need to be calculated only once.

temp = min( ab1[i]+cd2[j], cd1[j]+ab2[i]) + dist(a[i],b[i],c[j],d[j]);
if(temp<ans) ans=temp;

Can someone check this please. I am unable to understand why am i getting WA?
https://www.codechef.com/viewsolution/28483342

That’s not a link to you solution :slight_smile:

1 Like

Edited. Please check.

1 Like

Tried using Skip conditions with O(n^3) complexity but the last test case went wrong. Can this sol. be made correct with little changes ?
https://www.codechef.com/viewsolution/28510869