algorithm - Unable to solve a homework (ACM-training) -


i have no idea how solve this: http://acm.sgu.ru/problem.php?contest=0&problem=311

please me one

i know can solved using segment tree don't know how

  1. read of prices , set segment tree. each segment, store number , total cost of pieces prices lie in segment. that's of problem, , rest of answer rather vague in hopes learn something.

  2. handling arrival of pieces straightforward o(log n)-time descent in segment tree.

  3. handling purchase request o(log n)-time descent followed update if sale made. update may traverse large amount of segment tree , fast in amortized sense – interval should entered if , if there pieces in price range, , running time of removal should charged arrival.


Comments

Popular posts from this blog

c# - How to set Z index when using WPF DrawingContext? -

razor - Is this a bug in WebMatrix PageData? -

visual c++ - Using relative values in array sorting ( asm ) -