I did it in C++ using bigints and it works for 25/30 cases , the 5 fail because if i allow a number of digits high enough i get tle , if not i get WA , the algo is correct.
I did it in python too and i fail only on 3 cases i get TLE , so how did you implement the multiplication of bigints , O(N^2) is too much.
I tried to use the Karatsuba algo , but i cant find a good enough explanation so that i can code it out , it would reduce the complexity to O(N^1.58) which would be enough to pass the remaining 3 .
Any hints ?
I did it in python too and i fail only on 3 cases i get TLE , so how did you implement the multiplication of bigints , O(N^2) is too much.
I tried to use the Karatsuba algo , but i cant find a good enough explanation so that i can code it out , it would reduce the complexity to O(N^1.58) which would be enough to pass the remaining 3 .
Any hints ?