Help needed in Segment Tree with lazy propagation. (Div 1. Problem 446 C)

Правка en2, от gi_sha, 2018-08-06 09:47:26

I was trying this question, but repeatedly getting wrong answer on test case 5. I have tried a lot but cannot find where am I making the mistake.
My approach-
I have used segment trees with lazy propagation.
For each query of type 1, I will update my segment tree nodes with the sum of fibonaci numbers added corresponding to the nodes of the tree.
Then for finding answer to query [L-R], I have to just find the sum of values of the corresponding nodes from the tree and add sum of original array values in [L-R].
I was using the property that if one knows first two fibonacci numbers then one can find n th fibonaci number and also sum of first n fibonacci numbers. code link.
Any help given in this regard will be highly appreciated.

История

 
 
 
 
Правки
 
 
  Rev. Язык Кто Когда Δ Комментарий
en4 Английский gi_sha 2018-08-06 20:20:54 184 Tiny change: 'preciated.\n**Edit**' -> 'preciated.<br>\n**Edit**'
en3 Английский gi_sha 2018-08-06 14:16:48 42
en2 Английский gi_sha 2018-08-06 09:47:26 56
en1 Английский gi_sha 2018-08-05 21:36:44 925 Initial revision (published)