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

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

Hey everyone! I am getting "Time limit exceeded" prompt on a fairly easy question. Here's my code: https://codeforces.com/problemset/submission/1520/115570147. Can somebody point out why is my code exceeding the time limit with suitable corrections? Thanks in advance!

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

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

First of all $$$n \le 10^9$$$. And you are looping from $$$1$$$ to $$$10^9$$$. This is already $$$10^9$$$ operations which is already too much. You have to do something smarter then this naive bruteforce.