Crosscheck, my code does return 5508 for your input. Is this close to your answer?
3251 got accepted. Thanks. Will go through the code. BTW are you the creator of wings3d ! Awesome !
PS: I know what the error might be in my code.
I do not treat this situation correctly:
Aa.bB. My code will assign the
A, as it was the first in the input. The examples though tell us, to not assign those at all.
Ok, thanks for the update. Will keep it in mind while going through your code.
I quickly modified my code to print the first N largest areas, and I see that 3251 is the fourth largest one, so I’m pretty certain that my bug is that I include some infinite regions in the output. It appears that my approach for picking non-infinite regions is too naive. I pick all the input coordinates which are inside the bounding box (max/min x/y coordinates), which is definitely wrong. Since you got the same wrong output, maybe your version suffers from the same problem? I’ll fix my solution in the next few days.
Thanks, looking forward to it!
I got 3251 with my code so if you want to look at an inelegant solution feel free!
I fixed this bug and now have 3251 as a result with @theshank’s input as well.
Thanks, I will check it out asap.
@simon I dont know about the elegance of your solution, in terms of the algorithm used (since i havent gone throught it yet), but when it comes to readability, your code appears to be readable, despite the long functions. Thanks for sharing, I will go through it asap.
I pushed the fix for my solution. As I suspected, the algorithm for identifying infinite regions was wrong, so in some situations my code included some infinite regions when looking for the maximum one. The new version now returns 3251 for your input, while the result for my input remains unchanged. I guess I was lucky here to get an input which didn’t trigger the bug in my code.
Thanks, I will go through it.
Super readable code ! Thanks for sharing !