Help with TLE on CF 355 problem D

Revision en1, by AnotherRound, 2016-06-08 12:19:43

After reading the solution to problem D from last CF round, I decided to implement it(the idea with 2D segment tree). I know that there are other(faster) ways to implement segment tree as needed for RMQ, but I wanted to implement it with standard(check my code for what I call standard) implementation of 2D seg tree. Unfortunately, I got TL on test 16. So I wanted to ask whether there is some way to optimise my solution(without using the other faster way to implement segment tree). Link to my code: http://mirror.codeforces.com/contest/677/submission/18295468

Tags #codeforces, segment-tree, #355 div2 d

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en1 English AnotherRound 2016-06-08 12:19:43 590 Initial revision (published)