Блог пользователя Night_Lord

Автор Night_Lord, история, 3 года назад, По-английски

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

  • Проголосовать: нравится
  • -3
  • Проголосовать: не нравится

»
3 года назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

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

»
3 года назад, # |
Rev. 2   Проголосовать: нравится +6 Проголосовать: не нравится

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 года назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

Why dont you just use python or java

  • »
    »
    3 года назад, # ^ |
      Проголосовать: нравится +8 Проголосовать: не нравится

    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".