TOPIC

I need Help

Camilo C. Pacheco asked 2 years ago

Hi, i'm trying this problem, but i have this situation: When i use long long, veredict is TLE. When i use long / unsigned long, veredict is WA (maybe overflow).

I don't know how modify my code for a better performance :(

Question solved. Code removed.

This topic was solved and cannot recieve new replies.

  • Luis Fernando Veronese Trivelatto replied 2 years ago

    The slowest part of the code is in the fill function. The problem is that you're iterating over all multiples of 'i' for all 'i' between 1 and 'b' (up to 10^7). Try to figure out a way to avoid doing all that work (i.e., skipping the inner loop in line 14 for certain values of 'i'). Long long is indeed needed in the mod_pow function, but the time taken by it should be negligible.

  • Camilo C. Pacheco replied 2 years ago

    Thank you so much :)!