ENG  RUSTimus Online Judge
Online Judge
Problems
Authors
Online contests
About Online Judge
Frequently asked questions
Site news
Webboard
Links
Problem set
Submit solution
Judge status
Guide
Register
Update your info
Authors ranklist
Current contest
Scheduled contests
Past contests
Rules
back to board

Discussion of Problem 1486. Equal Squares

WA#10
Posted by Artem Khizha [DNU] 26 Jan 2011 03:53
At the moment my way is to look through all the squares of length LEN (using binary search) and to check, whether a hash of a square was met before. It is of O(N*M*log(min{N, M})) complexity.
But I get WA#10 again and again. Please, if someone had a problem with this test, share your impressions, 'cause I'm going slightly mad.
Re: WA#10
Posted by Kenny_HORROR 28 Jan 2011 21:17
You have a collisions with hash. (I've got this problem also because second number x was to small and close to first one).
Re: WA#10
Posted by Artem Khizha [DNU] 5 Jul 2012 16:29
Thank you, it really had to do with collisions. Actually, my self-made hashset implementation was fantastically awful. :-)

Edited by author 06.07.2012 15:48
binary search
Posted by Anwar 17 Sep 2018 18:51
Why you have used binary search? How we can say that the sq. matrix 2x2 has less value than 3x3. and 3x3 has less than 4x4. how can we justify?
Re: binary search
Posted by InstouT94 11 Dec 2024 16:38
We run a binary search on the length of the square's side. For a fixed length of the square's side, we calculate the hash of all squares with that side length, and look for a pair of squares with the same hash.