SharvanCN1's blog

By SharvanCN1, history, 2 years ago, In English

This was my submission 256491105. Can somebody explain to me why this solution gives TLE?

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

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

You’re making an array of size $$$2e5+1$$$ for every test case and there are like $$$10^4$$$ tests. Instead you should’ve made the array of size $$$n+1$$$, and then proceeded with whatever you’re doing (this will get rid of the TLE)