当前位置:网站首页>Gm3379 [noi2013 simulation] query
Gm3379 [noi2013 simulation] query
2022-07-18 12:53:00 【STJqwq】
GM3379 【NOI2013 simulation 】 Inquire about
The question : m m m Queries , The union of multiple interval resettable is queried every time ( No weight removal ) No p p p Small , The number of intervals in each query k k k No more than 5 5 5 individual , n , m ≤ 2 × 1 0 5 n,m\le 2\times 10^5 n,m≤2×105 .
Ideas : Think of one in two m i d mid mid bring ≤ m i d \le mid ≤mid Number ≥ p \ge p ≥p Then the chairman tree handles , But the time complexity is too high , yes O ( m k log w log n ) O(mk\log w\log n) O(mklogwlogn) , Cannot pass .
therefore , Look directly for No. on the chairman tree p p p Small .
Isn't this the way we used to write the chairman tree : Calculate the right root s i z e size size value , Subtract the left root , Then judge where you should be .
The same is true this time , Calculation all Right root Of s i z e size size , subtract all Left rooted s i z e size size value , Just fine .
prove : Why is this right ?
Because it moves left and right at the same time , It's the same l , r l,r l,r The pointer , Judgmental m i d mid mid It's the same , therefore All move towards a common goal .
as for In every specific tree Will there be an answer to the question , There is no such thing here , because The flow of the algorithm stipulates that it will not be affected by individuals to change the overall situation , Put overall interests first .
therefore , That's right .
边栏推荐
- 编程老司机带你玩转 CompletableFuture 异步编程
- In depth analysis of multiple knapsack problem (Part 1)
- 如何让加密的PDF文件可编辑
- SecureCRT print add timestamp
- How to systematically and efficiently learn the entry-level software testing and find the work of software testing?
- DINO&PAWS
- MySQL基礎——新增與進階查詢
- ThreadX kernel source code analysis (SMP) - thread execution core remap
- Nc20566 [scoi2010] games
- MySQL one-stop learning, read and learn
猜你喜欢
随机推荐
How to systematically and efficiently learn the entry-level software testing and find the work of software testing?
疑似被 Apple 招安,PlayCover 作者删库跑路
Data table design and API data construction of three-level classification
编程老司机带你玩转 CompletableFuture 异步编程
Px4 module design IX: introduction to Px4 flight mode
torch. gather()
FreeRTOS个人笔记-任务定义与任务切换
[unity technology accumulation] simulated FPS shooting function & radiographic testing
ORA-00322&ORA-00312
Detailed explanation and examples of anti shake throttling
MySQL基础——新增与进阶查询
企业如何选择合适的 Time Series Database?
MySQL基礎——新增與進階查詢
3 minutes to understand the three waiting methods of Web Automation
How does an enterprise choose the right time series database?
回家晚了些
Flume data collection
沉睡者的简历-有老板需要招兵买马吗?您的成功就差一个我
FreeRTOS personal notes - a preliminary discussion on the cm3 kernel
欺诈性抚养可主张已支付的抚养费和精神损害抚慰金








