Finally I could solve it with mapping. It was really hard for me. I’m learning C++ and it was the first problem I solved with that language. I don’t know what data structures are more efficiently for each kind of problem in that language.
I did it!
I replaced all my fancy containers and iterators with good old pointers and dynamic arrays to finally pass the High density tests…
but still… I wonder how can I get to pass the High density tests with a more modern C++ like solution rather than an almost C one?
EDIT: nevermind I can actually access the solutions since I passed 100%
I thank the author for this puzzle and you guys who posted. I’m doing it with Java.
I only pass the 3 first tests : simple, squarish and bigger 1, and validators 1,2,3,6
I do nested loops to store x and y gaps and then compare them. I saw that it is what it is just advised by the author in his hidden hint.
I specify that I don’t have time out issue but lower square detection
Please help !
More gems to discover. A few more messages about enhancing efficiency were posted below the hidden hints.