Night_Lord's blog

By Night_Lord, history, 3 years ago, In English

Hello, as the constrains are huge I used big integers to multiply the numbers in this problem from ABC. However I am still getting TLE .Anyone help me how I use Big Integer for this problem? My submission is here The blog I followed for the Big Integer code is here

  • Vote: I like it
  • -3
  • Vote: I do not like it

| Write comment?
»
3 years ago, # |
  Vote: I like it 0 Vote: I do not like it

I remember someone solved this problem using int_128 in C++ very easily . You can try that .

  • »
    »
    3 years ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    give the link of your submisson please

»
3 years ago, # |
Rev. 2   Vote: I like it +6 Vote: I do not like it

I made a few moderations to your code.I hope you get that well. - Check mainly two number's.If they overflow then check the condition.

code
»
3 years ago, # |
  Vote: I like it 0 Vote: I do not like it

Why dont you just use python or java

  • »
    »
    3 years ago, # ^ |
      Vote: I like it +8 Vote: I do not like it

    I'm very sure that if you write OP's code in Java it will also get TLE. OP just multiplies the numbers together and allows the result to grow to $$$(10^{18})^{10^5)} \approx 10^{10^6}$$$. Doing $$$10^5$$$ multiplications with such numbers is too slow even if you use smart multiplication algorithms.

    The problem statement isn't "can you work with bigints", it's "are you smart enough to break if the number grows too big".