Блог пользователя M.A.H.M.O.O.D

Автор M.A.H.M.O.O.D, история, 8 лет назад, По-английски

Hi everyone.

I'm trying to solve GSS1 in spoj (link) but I'm getting WA can anybody please tell me what's wrong ???

here's my code.

I really need help I'd be very grateful for any kind of assist.

thank you for reading.

:)

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

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

Your query function isn't correct. Bug is here:

return quary((node * 2) + 1, mid + 1, endd, l, r)), quary(node * 2, start, mid, l, r) + quary((node * 2) + 1, mid + 1, endd, l, r);

Are you sure that answer for left son and right son always form a continuous segment? It means that your query function have to return your struct (with maximum prefix, maximum suffix, sum and maximum sum), not only maximum sum. To read more about this task click (topic in Russian, but implementation is very clear).