線段樹專題

2021-06-17 18:16:14 字數 2790 閱讀 4707

最最基礎的線段樹,只更新葉子節點,然後把資訊用pushup(int r)這個函式更新上來。

hdu1166 敵兵布陣

線段樹 hdu 1166 敵兵布陣 單點更新區間求和

hdu1754 i hate it

線段樹 hdu 1754 i hate it 單點更新 區間求最值

hdu1394 minimum inversion number

hdu 1394 minimum inversion number 線段樹 逆序數

hdu2795 billboard

hdu 2795 billboard 線段樹 單點更新

uva 12299 - rmq with shifts 線段樹 單點更新

poj2828 buytickets

poj2886 who getsthe most candies?

hdu4288 coder

cf85-dsum of medians

codeforcesbeta round #19 d. points

poj2481 cows

hdu3950 parking log

hdu4521 小明系列問題——小明序列

codeforcesbeta round #99 (div. 1) c mushroom gnomes - 2

成段更新

需要用到延遲標記(或者說懶惰標記),簡單來說就是每次更新的時候不要更新到底,用延遲標記使得更新延遲到下次需要更新or詢問到的時候。

hdu1698 just a hook

線段樹 1698 just a hook 區間set更新

poj3468 a ****** problem with integers

線段樹 poj 3468 a ****** problem with integers 區間add更新

poj2528 mayor』s posters

poj 2528 mayor's posters 線段樹 離散化 成段更新

poj3225 help with intervals

poj1436 horizontally visible segments

poj2991 crane

another lcis

bracket sequence

uva 11992 - fast matrix operations 成段更新,求最值與和

codeforcesround #136 (div. 2) d. little elephant andarray

codeforcesround #169 (div. 2) e.little girl and problemon trees

codeforcesbeta round #35 (div. 2) e. parade

zoj3299 fall the brick

fzu2105 digits count

hdu 4533 威威貓系列故事——曬被子

區間合併

這類題目會詢問區間中滿足條件的連續最長區間,所以pushup 的時候需要對左右兒子的區間進行合併。

poj3667 hotel

poj 3667 hotel 線段樹 區間合併

hdu3308 lcis

hdu3397 sequence operation

hdu2871 memory control

hdu1540 tunnel wa***re

cf46-d parking lot

掃瞄線這類題目需要將一些操作排序,然後從左到右用一根掃瞄線掃過去,最典型的就是矩形面積並、周長並等題。

hdu1542 atlantis

hdu 1542 atlantis 線段樹 求矩形面積並

hdu1828 picture

hdu3265 posters

hdu3642 get the treasury

poj2482 stars in your window

poj2464 brownie points ii

hdu3255 farming

ural1707 hypnotoad』s secret

uva11983 weird advertisement

hdu1255 覆蓋的面積

hdu4052 adding new machine

uestc1525 fruit ninja

多顆線段樹問題

此類題目主用特點是區間不連續,有一定規律間隔,用多棵樹表示不同的偏移區間

hdu 4288 coder

hdu 4267 a ****** problem with integers

其他hdu3954 level up

hdu4027 can you answer these queries?

hdu3333 turing tree

hdu3874 necklace

hdu3016 man down

hdu3340 rain in acstar

zju3511 cake robbery

uestc1558 charitable exchange

cf85-d sum of medians

spojgss2 can you answer these queries ii

poj3162 walkingrace

hdu4358 boring counting

hdu4417 super mario

uvalive4730 kingdom

codeforcesround #163 (div. 2) e. more queries toarray...

線段樹專題

題意 給定n個數 a1,a2,a na 1,a 2,dots,a n a1 a2 an 給出q個詢問求 l,r 內所有子區間的異或和。比如,陣列1,2,3中 1,3 的異或和為 1 1 xor2 1xo r2xo r3 2 2xo r3 3 1 1xor2 1xor2xor3 2 2xor3 3 1...

線段樹專題

敵兵布陣 單點更新,區間求和查詢 include include include include include using namespace std const int maxn 5e4 5 struct nodet maxn 4 int a maxn nsum void build int x...

ACM 線段樹 專題

其中應該有我以前 刷過的題吧 沒有辦法 演算法這東西 一不刷 就會忘。像這道題 我 就wa了 四發 才過 但是 我 以前確實過過。再重新理解一下吧 大概就是 線段樹 就是 左右 節點 然後 上面就是 我們的 和 建立的時候和每次修改 都要更新一下父節點 也就是子節點的和 樹這個東西 仔細想想 確實集...