Successfully reported this slideshow.
Upcoming SlideShare
×

# セグツリーイメージ

2,611 views

Published on

http://d.hatena.ne.jp/kyuridenamida/

Published in: Education
• Full Name
Comment goes here.

Are you sure you want to Yes No
• 最初lazy=2ですね...

Are you sure you want to  Yes  No

### セグツリーイメージ

1. 1. Step1. [1,5]に2を足す. value = 0 , lazy = 0 value = 0 , lazy = 0 value = 0 , lazy = 0 value = 0 , lazy = 0 value = 0 , lazy = 0 value = 0 , lazy = 0 value = 0 , lazy = 0value = 0 value = 0 value = 0 value = 0 value = 0 value = 0 value = 0 value = 0 lazy = 0 lazy = 0 lazy = 0 lazy = 0 lazy = 0 lazy = 0 lazy = 0 lazy = 0 1 2 3 4 5 6 7 8
2. 2. Step1. [1,5]に2を足す. value = 0 , lazy = 0 value = 0 , lazy = 0 value = 0 , lazy = 0 value = 0 , lazy = 0 value = 0 , lazy = 0 value = 0 , lazy = 0 value = 0 , lazy = 0value = 0 value = 0 value = 0 value = 0 value = 0 value = 0 value = 0 value = 0 lazy = 0 lazy = 0 lazy = 0 lazy = 0 lazy = 0 lazy = 0 lazy = 0 lazy = 0 1 2 3 4 5 6 7 8
3. 3. Step1. [1,5]に2を足す. value = 0 , lazy = 0 value = 0 , lazy = 1 value = 0 , lazy = 0 value = 0 , lazy = 0 value = 0 , lazy = 0 value = 0 , lazy = 0 value = 0 , lazy = 0value = 0 value = 0 value = 0 value = 0 value = 0 value = 0 value = 0 value = 0 lazy = 0 lazy = 0 lazy = 0 lazy = 0 lazy = 0 lazy = 0 lazy = 0 lazy = 0 1 2 3 4 5 6 7 8
4. 4. Step1. [1,5]に2を足す. value = 0 , lazy = 0 value = 8 , lazy = 0 value = 0 , lazy = 0 value = 0 , lazy = 2 value = 0 , lazy = 2 value = 0 , lazy = 0 value = 0 , lazy = 0value = 0 value = 0 value = 0 value = 0 value = 0 value = 0 value = 0 value = 0 lazy = 0 lazy = 0 lazy = 0 lazy = 0 lazy = 0 lazy = 0 lazy = 0 lazy = 0 1 2 3 4 5 6 7 8
5. 5. Step1. [1,5]に2を足す. value = 0 , lazy = 0 value = 8 , lazy = 0 value = 0 , lazy = 0 value = 0 , lazy = 2 value = 0 , lazy = 2 value = 0 , lazy = 0 value = 0 , lazy = 0value = 0 value = 0 value = 0 value = 0 value = 0 value = 0 value = 0 value = 0 lazy = 0 lazy = 0 lazy = 0 lazy = 0 lazy = 0 lazy = 0 lazy = 0 lazy = 0 1 2 3 4 5 6 7 8
6. 6. Step1. [1,5]に2を足す. value = 0 , lazy = 0 value = 8 , lazy = 0 value = 0 , lazy = 0 value = 0 , lazy = 2 value = 0 , lazy = 2 value = 0 , lazy = 0 value = 0 , lazy = 0value = 0 value = 0 value = 0 value = 0 value = 0 value = 0 value = 0 value = 0 lazy = 0 lazy = 0 lazy = 0 lazy = 0 lazy = 0 lazy = 0 lazy = 0 lazy = 0 1 2 3 4 5 6 7 8
7. 7. Step1. [1,5]に2を足す. value = 0 , lazy = 0 value = 8 , lazy = 0 value = 0 , lazy = 0 value = 0 , lazy = 2 value = 0 , lazy = 2 value = 0 , lazy = 0 value = 0 , lazy = 0value = 0 value = 0 value = 0 value = 0 value = 0 value = 0 value = 0 value = 0 lazy = 0 lazy = 0 lazy = 0 lazy = 0 lazy = 2 lazy = 0 lazy = 0 lazy = 0 1 2 3 4 5 6 7 8
8. 8. Step1. [1,5]に2を足す. value = 0 , lazy = 0 value = 8 , lazy = 0 value = 0 , lazy = 0 value = 0 , lazy = 2 value = 0 , lazy = 2 value = 0 , lazy = 0 value = 0 , lazy = 0value = 0 value = 0 value = 0 value = 0 value = 2 value = 0 value = 0 value = 0 lazy = 0 lazy = 0 lazy = 0 lazy = 0 lazy = 0 lazy = 0 lazy = 0 lazy = 0 1 2 3 4 5 6 7 8
9. 9. Step1. [1,5]に2を足す. value = 0 , lazy = 0 value = 8 , lazy = 0 value = 0 , lazy = 0 value = 0 , lazy = 2 value = 0 , lazy = 2 value = 2 , lazy = 0 value = 0 , lazy = 0value = 0 value = 0 value = 0 value = 0 value = 1 value = 0 value = 0 value = 0 lazy = 0 lazy = 0 lazy = 0 lazy = 0 lazy = 0 lazy = 0 lazy = 0 lazy = 0 1 2 3 4 5 6 7 8
10. 10. Step1. [1,5]に2を足す. value = 0 , lazy = 0 value = 8 , lazy = 0 value = 2 , lazy = 0 value = 0 , lazy = 2 value = 0 , lazy = 2 value = 2 , lazy = 0 value = 0 , lazy = 0value = 0 value = 0 value = 0 value = 0 value = 2 value = 0 value = 0 value = 0 lazy = 0 lazy = 0 lazy = 0 lazy = 0 lazy = 0 lazy = 0 lazy = 0 lazy = 0 1 2 3 4 5 6 7 8
11. 11. Step1. [1,5]に2を足す. value = 10 , lazy = 0 value = 8 , lazy = 0 value = 2 , lazy = 0 value = 0 , lazy = 2 value = 0 , lazy = 2 value = 2 , lazy = 0 value = 0 , lazy = 0value = 0 value = 0 value = 0 value = 0 value = 2 value = 0 value = 0 value = 0 lazy = 0 lazy = 0 lazy = 0 lazy = 0 lazy = 0 lazy = 0 lazy = 0 lazy = 0 1 2 3 4 5 6 7 8
12. 12. Step2. [4,4]の値を求める value = 10 , lazy = 0 value = 8 , lazy = 0 value = 2 , lazy = 0 value = 0 , lazy = 2 value = 0 , lazy = 2 value = 2 , lazy = 0 value = 0 , lazy = 0value = 0 value = 0 value = 0 value = 0 value = 2 value = 0 value = 0 value = 0 lazy = 0 lazy = 0 lazy = 0 lazy = 0 lazy = 0 lazy = 0 lazy = 0 lazy = 0 1 2 3 4 5 6 7 8
13. 13. Step2. [4,4]の値を求める value = 10 , lazy = 0 value = 8 , lazy = 0 value = 2 , lazy = 0 value = 0 , lazy = 2 value = 0 , lazy = 2 value = 2 , lazy = 0 value = 0 , lazy = 0value = 0 value = 0 value = 0 value = 0 value = 2 value = 0 value = 0 value = 0 lazy = 0 lazy = 0 lazy = 0 lazy = 0 lazy = 0 lazy = 0 lazy = 0 lazy = 0 1 2 3 4 5 6 7 8
14. 14. Step2. [4,4]の値を求める value = 10 , lazy = 0 value = 8 , lazy = 0 value = 2 , lazy = 0 value = 4 , lazy = 0 value = 0 , lazy = 2 value = 2 , lazy = 0 value = 0 , lazy = 0value = 0 value = 0 value = 0 value = 0 value = 2 value = 0 value = 0 value = 0 lazy = 2 lazy = 2 lazy = 0 lazy = 0 lazy = 0 lazy = 0 lazy = 0 lazy = 0 1 2 3 4 5 6 7 8
15. 15. Step2. [4,4]の値を求める value = 10 , lazy = 0 value = 8 , lazy = 0 value = 2 , lazy = 0 value = 4 , lazy = 0 value = 2 , lazy = 0 value = 2 , lazy = 0 value = 0 , lazy = 0value = 0 value = 0 value = 0 value = 0 value = 2 value = 0 value = 0 value = 0 lazy = 2 lazy = 2 lazy = 2 lazy = 2 lazy = 0 lazy = 0 lazy = 0 lazy = 0 1 2 3 4 5 6 7 8
16. 16. Step2. [4,4]の値を求める value = 10 , lazy = 0 value = 8 , lazy = 0 value = 2 , lazy = 0 value = 4 , lazy = 0 value = 2 , lazy = 0 value = 2 , lazy = 0 value = 0 , lazy = 0value = 0 value = 0 value = 2 value = 2 value = 2 value = 0 value = 0 value = 0 lazy = 2 lazy = 2 lazy = 0 lazy = 0 lazy = 0 lazy = 0 lazy = 0 lazy = 0 1 2 3 4 5 6 7 8
17. 17. Step2. [4,4]の値を求める value = 10 , lazy = 0 value = 8 , lazy = 0 value = 2 , lazy = 0 value = 4 , lazy = 0 value = 2 , lazy = 0 value = 2 , lazy = 0 value = 0 , lazy = 0value = 0 value = 0 value = 2 value = 2 value = 2 value = 0 value = 0 value = 0 lazy = 2 lazy = 2 lazy = 0 lazy = 0 lazy = 0 lazy = 0 lazy = 0 lazy = 0 1 2 3 4 5 6 7 8
18. 18. Step2. [4,4]の値を求める value = 10 , lazy = 0 value = 8 , lazy = 0 value = 2 , lazy = 0 value = 4 , lazy = 0 value = 4 , lazy = 0 value = 2 , lazy = 0 value = 0 , lazy = 0value = 0 value = 0 value = 2 value = 2 value = 2 value = 0 value = 0 value = 0 lazy = 2 lazy = 2 lazy = 0 lazy = 0 lazy = 0 lazy = 0 lazy = 0 lazy = 0 1 2 3 4 5 6 7 8
19. 19. Step2. [4,4]の値を求める value = 10 , lazy = 0 value = 8 , lazy = 0 value = 2 , lazy = 0 value = 4 , lazy = 0 value = 4 , lazy = 0 value = 2 , lazy = 0 value = 0 , lazy = 0value = 0 value = 0 value = 2 value = 2 value = 2 value = 0 value = 0 value = 0 lazy = 2 lazy = 2 lazy = 0 lazy = 0 lazy = 0 lazy = 0 lazy = 0 lazy = 0 1 2 3 4 5 6 7 8
20. 20. Step2. [4,4]の値を求める value = 10 , lazy = 0 value = 8 , lazy = 0 value = 2 , lazy = 0 value = 4 , lazy = 0 value = 4 , lazy = 0 value = 2 , lazy = 0 value = 0 , lazy = 0value = 0 value = 0 value = 2 value = 2 value = 2 value = 0 value = 0 value = 0 lazy = 2 lazy = 2 lazy = 0 lazy = 0 lazy = 0 lazy = 0 lazy = 0 lazy = 0 1 2 3 4 5 6 7 8
21. 21. Step2. [4,4]の値を求める value = 10 , lazy = 0 value = 8 , lazy = 0 value = 2 , lazy = 0 value = 4 , lazy = 0 value = 4 , lazy = 0 value = 2 , lazy = 0 value = 0 , lazy = 0value = 0 value = 0 value = 0 value = 2 value = 2 value = 0 value = 0 value = 0 lazy = 2 lazy = 2 lazy = 2 lazy = 0 lazy = 0 lazy = 0 lazy = 0 lazy = 0 1 2 3 4 5 6 7 8