start_code_end's blog

By start_code_end, history, 3 years ago, In English

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!

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

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

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.