magical STL makes convex hull problems so easy to get accepted

conevex hull problems requires sorting the points in 2D in anticlockwise sense with the first point being the one with lowest y co-ord (x co-ord breaks the tie)
so this can be done by first sorting the points in order of y co-ord and then in order of polar angle by using apt comparison functions…
i solved 2 problems on spoj using it and it was a nice learning curve
heres my code :
GRDENHULL : http://ideone.com/4Z7RHX
BSHEEP : http://ideone.com/4zJsSa

c++11 complex container : http://www.cplusplus.com/reference/complex/complex/complex/

1 Like