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

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

lately I starting studying segment tree in the EDU section

there are some problem to practice that the introducer didnt solve and leave it as exercises

I tried to solve this one but unfortunately the result was (time limit exceeded)

can you help me solving this problem or tell me what is the problem in my solution

this is the problem

274684B-Cryptography

and this is my solution My Solution

Edit: Unfortunately, it seems that I cannot point to the solution and the problem because it is in the member section so I will put them as links

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

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

Returning a 2d vector multiple times in a recursive function causes your code to TLE. You can either use 4 integers to represent the 2x2 matrix (which was what I did) or implement iterative segment tree (too lazy to implement it but I guess it should work). Click here to view my accepted code.