Jomax100's blog

By Jomax100, history, 4 years ago, In English

I am working on Segment Trees, and more recently with this implementation by Al.Cash

He brings up this problem but even with the segment tree already built (I assume it stores the number of 'c's in a given range) I don't know how to answer the queries in O(logn). If it's all 'c's then it's easy but what if it's not? Some sort of divide and conquer?

I would appreciate some help with that problem, and recommendations for other good segment tree problems. Preferably on Codeforces (there is no segTree tag; data structures is the closest but it's no guarantee).

Thanks and have a good day!

Full text and comments »

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

By Jomax100, history, 4 years ago, In English

As the title suggests, I submitted the identical source code, which in my environment and in c++17 gives the right answer, but in c++14 it gives WA. I am aware this usually involves some sort of default initialization, but I believe my codes does not rely on that. I appreciate your help and insights as to what might be happening!

WA

AC

Two editorials for this problem, but I followed this one

Full text and comments »

  • Vote: I like it
  • +18
  • Vote: I do not like it