We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
Hello,
I'm using Java and have the problem, that the test cases except the first one always run out of time (>4s). I optimized my algorithm, now I can run 10^6 times a difficult input in time:
(250000000000000 100000000000000000)
Still the test cases don't finish..
I don't get what's different in these..
Any hints or ideas what I'm missing? I really got stuck here..
Maybe your optimisations for big m have a detrimental effect on the runtime for small m. For small m the number of red zones can become very big. In Python I have been able to run all tests in sub second time.
This comment may be too late to help you personally, but in my first submission attempt, I had time limit exceeded with similar inputs. However, it turned out to be a couple of embarrassing typos/implementation bugs.
No more comments
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Join us
Create a HackerRank account
Be part of a 26 million-strong community of developers
Please signup or login in order to view this challenge
nice problem. found a method to compute F(m,n) in O((n/m)^2) time which causes it to run instantly
Hello, I'm using Java and have the problem, that the test cases except the first one always run out of time (>4s). I optimized my algorithm, now I can run 10^6 times a difficult input in time: (250000000000000 100000000000000000) Still the test cases don't finish.. I don't get what's different in these..
Any hints or ideas what I'm missing? I really got stuck here..
Thanks
Maybe your optimisations for big m have a detrimental effect on the runtime for small m. For small m the number of red zones can become very big. In Python I have been able to run all tests in sub second time.
This comment may be too late to help you personally, but in my first submission attempt, I had time limit exceeded with similar inputs. However, it turned out to be a couple of embarrassing typos/implementation bugs.