Hello all,

Can anyone help me out? I am trying to upsolve POINPOLY using the approach of dividing the given vertices into four groups :-

- x:even,y:even
- x:odd,y:odd
- x:even,y:odd
- x:odd,y:even

After doing this i am just finding the mid point of line segments formed by any two vertices of same group (as it will have integer coordinates). Now, as per my thinking the mid-point of line segment formed by any two vertices of the polygon lying in the same group out of these four shall lie inside the polygon and so there should not be any need to check if it lies inside the polygon but when i submit the code without checking this, i get WA, link to that code of mine is :- https://www.codechef.com/viewsolution/17444855

However when i check whether the mid-point lies inside or not and then submit, I get TLE as expected in some of the cases :- https://www.codechef.com/viewsolution/17444843

Can someone help me out with this, like where i am going wrong, is there any thing wrong with my approach etc and most importantly why we need to check for the mid point to lie inside the polygon if in case itâ€™s required.