### suraj021's blog

By suraj021, 5 years ago, ,

I solved 380C - Sereja and Brackets using segment tree for logarithmic time complexity , but my my solution got TLE 11267626 for some test case . I want to ask if there is something wrong with my implementation or i have to use some other data structure ? P.S positive responses will be appreciated :)

UPD: Accepted: 11271890 :)

• +1

 » 5 years ago, # | ← Rev. 2 →   +3 void build( string str, int id, int l, int r ){ if you write it this way string str will be copied each time you call the build function, so total complexity is O(n^2).You should change it to void build( string& str, int id, int l, int r ){ P.S 11267959 Accepeted by changing only this char)
•  » » 5 years ago, # ^ |   0 Thanks Got AC. But there is significant amount of memory used. Is it because of large strings and long queries or something else? Thanks a lot sir,
 » 5 years ago, # |   -18 u are too noob
•  » » 5 years ago, # ^ |   0 My graph shows that , doesn't it ? :)
•  » » » 5 years ago, # ^ |   0 no your handle shows it
•  » » » » 5 years ago, # ^ |   0 You have nothing to do with this.Either answer the question which he asked or get lost.You Big mouth.