当前位置:网站首页>F-niu Mei's apple tree (diameter combined)
F-niu Mei's apple tree (diameter combined)
2022-04-23 09:42:00 【Zimba_】
The question :
A tree n n n A tree of nodes , Each edge has an edge weight w i wi wi. Yes q q q Time to ask , Every time I ask l l l and r r r, seek m a x ( d i s t ( u , v ) ) , l ≤ u ≤ v ≤ r max(dist(u,v)),l\leq u\leq v\leq r max(dist(u,v)),l≤u≤v≤r.
( 1 ≤ n , q ≤ 300000 ) (1\leq n,q\leq 300000) (1≤n,q≤300000)
practice :
Here's a conclusion : The diameter endpoints of two subgraphs are known , Then the diameter of the merged two graphs , Take the farthest two of these four points .
So this problem is considered to be multiplied to deal with ST surface . You need to merge the maximum values of the two intervals , Just save the diameter endpoint of each interval , You can merge to get a new diameter .
Code :
The solution is so simple , Code YY Just a moment .
版权声明
本文为[Zimba_]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/04/202204230621425179.html
边栏推荐
- Kettle实验 转换案例
- Two ways for flutter providers to share data
- Golang force buckle leetcode 396 Rotation function
- 三、6【Verilog HDL】基础知识之门级建模
- npm ERR! network
- Kettle experiment
- 501. Mode in binary search tree
- JS and how to judge custom attributes in H5
- Sql1 [geek challenge 2019]
- How to use SQL statement union to get another column of another table when the content of a column in a table is empty
猜你喜欢
Chapter VIII project stakeholder management of information system project manager summary
3、 6 [Verilog HDL] gate level modeling of basic knowledge
Node installation
Kettle实验 转换案例
Cloud computing competition -- basic part of 2020 competition [task 3]
数据清洗 ETL 工具Kettle的安装
Two methods of building Yum source warehouse locally
Introduction to sap pi / PO login and basic functions
kernel-pwn学习(4)--Double Fetch&&0CTF2018-baby
kettle庖丁解牛第14篇之JSON输入
随机推荐
NLLLoss+log_ SoftMax=CE_ Loss
Codeforces Round #784 (Div. 4)
JS what is an event? Event three elements and operation elements
三、6【Verilog HDL】基础知识之门级建模
Personal homepage software fenrus
Golang force buckle leetcode 396 Rotation function
kettle实验
How to use SQL statement union to get another column of another table when the content of a column in a table is empty
Introduction to sap pi / PO login and basic functions
kernel-pwn学习(4)--Double Fetch&&0CTF2018-baby
DVWA range practice record
JS scope, scope chain, global variables and local variables
ABAP implementation publishes restful services for external invocation example
高薪程序员&面试题精讲系列91之Limit 20000加载很慢怎么解决?如何定位慢SQL?
SAP pi / PO soap2proxy consumption external WS example
[educational codeforces round 80] problem solving Report
C语言:表达式求值(整型提升、算术转换 ...)
What is monitoring intelligent playback and how to use intelligent playback to query video recording
Kettle experiment
Dropout技术之随机神经元与随机深度