I thought for a long time and tried something like FFT to solve it but failed.
In fact,I haven't find a algorithm better than brute force,which is $$$O(n^2)$$$.
I thought for a long time and tried something like FFT to solve it but failed.
In fact,I haven't find a algorithm better than brute force,which is $$$O(n^2)$$$.
I do wrote it by myself, but I'm not with an ability to translate it into English.
Here is the link.
Also,I can't find it by using search engine。