Sunday, August 17, 2014

Helping Lira


Problem Link : http://www.codechef.com/problems/HELPLIRA

Idea: For N triangle,Given the co-ordinates of three point for each.First calculate the area of each triangle and push in a vector.Take another vector and push in it the values of first vector. Sort second vector.Now we have minimum value at V2[0] and maximum value at V2[size-1].Our answers are the indexes of minimum value and maximum value in first vector.If there are multiple maximum or minimum value,we have to result for the last.For that,search maximum(Contained in V2[size-1]) and minimum (Contained in V2[0]) value in first vector from the last.If one if found,keep continue for another one.Then show output.

My Solution: http://pastebin.com/GFpyevR1

No comments:

Post a Comment