Cool thanks I was only able to get step 1, but wasnât able to convince myself of step 2 during the contest. Itâs much clearer now.
jaskaran: If you actually looked more into how/why it works this way, youâd notice that Cooley-Tukey makes use of identities involving the N-th root of unity, and those are only nice if we split the FFTâd array into arrays of equal sizes.
Youâre basically padding the array to next larger power of 2, which changes its roots of unity. The most trivial example: {1,1,0} has no solution, but your answer is YES.
Is it really that hard to check small cases by hand when you have days for this?
@xelios I had given the incorrect link. Iâve edited it.Could you check it now?It works for 1 1 0.
Really awesome explanation @kevinsogo, I am always amazed by how clever and insightful some top coders can be and this is for sure an inspiration for me to keep working harder on my side to improve
Thanks for the amazing story
jaskaran: Except it does not work for {1,1,0}. Read what I wrote again. Your solution answers YES, the correct answer is NO.
waw. amazing explaination throughout your trials and errors. thanks a lot, mate !
iâll try to get AC with your ideas. thank you so much !
@cyberax I will try to explain these questions more clearly and thoroughly. Thanks for your concerning.
xelios:Why is it giving NO on my compiler but not on IDEONE?
I donât know your platform, so I canât answer that⌠but Iâd expect the Ideone to be more similar to Codechef testing systemâŚ
Precision is usually not a problem. Ever. Out of hundreds of problems that require doubles among thousands Iâve solved, this is the 2nd one where Iâm getting WA because of precisions errors.
sum of d * nu(d) is O(n * log(n), because sum of d is O(n) and max(nu(d)) is O(log(n)).
thank you for the update ! i tried to understand what did that check() function too⌠well done !