If you got TLE on test>28, try this test 50000 0 0 0 0 ... 50000 points (0,0) 0 0 Thanks man, that really helped what is case 8 like,i just can't solve it with divede and conquer... If there is three equal points than perimeter equals zero? Something strange: if three points with equal coordinates than output zero. > WA6 if four points with equal coordinates than output zero. > AC This made me crazy. Can somebody clarify? I have the same trouble. Maybe something wrong with test or checker? If you have WA on 16 test than maybe you have error in calculation of (xi  xj)^2. See problem statement xi < 10^6 so (xixj)^2 may be 4*10^12 and it does not fit in int type. Thanks a lot indeed! This is just where I've been confused with and your tips are really helpful! I got AC on this problem with 0.14 sec and 6400 kb memory. But most people submitted problem with 1 Mb memory. Who can send on email void438@inbox.ru solution with less memory and time? nothing here Edited by author 03.08.2009 18:22 Try some kind of "divide and conquer" algorithm. My algorithm is based on the algorithm of finding the closest pair of points, used the same pruning. Believe me, what you think is impossible this time it's possible. Thanks...:) I was thinking of using Voronoi Diagram or Delaunay Triangulation to solve it.... Are U crazy? On ACM problems? i have write bruteforce procedure solve() and test my program on random tests. my program always gives correct answer. I have not so twisted imagination, which have autors this tests, so i can't think up such test. My congratulations to autors: your imagination is more twisted than rand() :) Your should be greatful to authors who keep in secret speeding up methods and give you(and us) chance to create them. Now I can't see how avoid O(n^3) For example may be 16000 smal identical triangles and so on. I think 15test is last with small N. So nottopcoders may move to solution by exchanging with ideas on forum. Edited by author 17.02.2007 22:04 there is NlogN solution Why in this case you use use brute force and random? because my NlogN solution gives wrong answer on 16th test and i tryed to find such test, that BruteForce answer differs with MyNlogNSolution answer Try to prove your algorithm. If proof right and authors is'n mistaken you will pass test 16 without difficulties. Or test #1 is not a sample? Or compiler bug, as usual? Oh, I'm sorry... I submitted solution of other problem  AC now... Edited by author 29.01.2007 15:22 If my program gets WA on test# 16, does it mean that it is accepted for(i=1;i<=15;i++) test# i? (no wrong answer, memory limit ok, no stack overflow, everything all right)? It means, that your program passed first 15 tests successfully, but got WA on test #16. So, the problem is not solved... I got TLE on test #17, but it didn't use too much memory, what is the problem...? If the number of points is very big then it should use a large amount of memory ...@_@ My divideandconquer algorithm failed on test case #16 @_@ 
