I tried 2 different solutions using both a set and a hashtable and used exactly the same logic give above. Both were taking more time than expected! :frowning:

Thanks!!I also even don’t knew [] and find can change a TLE to AC!!

Yes, even i just pulled up a random AC answer and was wrong with the same kind of test case.

It was clearly mentioned that the square need not have its sides parallel to the X and Y axes. Your two assumptions would be always true only if the square had sides parallel to the X and Y axes.
example -
(1,1) (3,5) and (-1,7) and (-3,3) form a square. So here your second point fails that 1,1 and 3,5 should necessarily be on the diagonal as they dont form a side parallel to the axes.

@admin​:diamonds::diamonds: Please update tester and setter’s solution.

My ACed solution gives 0. By the way you can report this as feedback to codechef.

@pranjalranjan yes :stuck_out_tongue:

@shiva1k95_10 you’ve used so much of if-else statements then it might give TLE for some big value of N say 2000. Use random cases to check this. An use switch for faster evaluation.

@kihsuak did you check your solve1 and solve functions, I think they’re not completely correct.

Thats the bad thing…i reported it…and still stronger test cases were not added!

if you’re asking how to get the other 2 points, regardless that the problem is not even asking for it, then treat the 2 points as a line segment then rotate it 90 degrees along the midpoint of the line. you can rotate either the line or just the points.

if set has only 2 points then too it is not possible to construct a square of these points by adding 2 other points. for eg. {(0,0), (1,3)} is given set of points. the answer should be 2(as deducted from the logic in above post) but it can be seen that answer is 3.