JZOJsenior1738.Heatwave

problem

Description

  给你N个点的无向连通图,图中有M条边,第j条边的长度为: d_j.
  现在有 K个询问。
  每个询问的格式是:A B,表示询问从A点走到B点的所有路径中,最长的边最小值是多少?

Input

  文件名为heatwave.in
  第一行: N, M, K。
  第2..M+1行: 三个正整数:X, Y, and D (1 <= X <=N; 1 <= Y <= N). 表示X与Y之间有一条长度为D的边。
  第M+2..M+K+1行: 每行两个整数A B,表示询问从A点走到B点的所有路径中,最长的边最小值是多少?

Output

  对每个询问,输出最长的边最小值是多少。

Sample Input

6 6 8
1 2 5
2 3 4
3 4 3
1 4 8
2 5 7
4 6 2
1 2
1 3
1 4
2 3
2 4
5 1
6 2
6 1

Sample Output

5
5
5
4
4
7
4
5

Data Constraint

50% 1<=N,M<=3000 其中30% K<=5000
​100% 1 <= N <= 15,000   1 <= M <= 30,000   1 <= d_j <= 1,000,000,000   1 <= K <= 20,000

Hint


analysis

既然题目要求两点间最长边的最小值,那么我们就把这幅图的MST先求出来
这样两点间一定联通且满足两点间最长边最小(没有为什么自己想一想因为这点比较明显)
MST用kruskal求,比较基础,我就当你会了
求完MST之后把整棵树遍历一次,求出每个点的深度

树上倍增

(这题的JZ数据buff加成导致 O(n) LCA 乱搞也能AC……然后嘿嘿嘿
然后打了个奇丑无比倍增
维护两个数组 anc[i,j] dis[i,j] 分别表示i节点的2^j号祖先和i节点的与第2^j号祖先之间的路径最小值
接下来就和普通倍增没什么区别了,先把两个点调至同一深度,然后一起往上跳,跳的过程中记录答案

时间复杂度 O(mlog2m+nlog2n+qlo

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
Heatwaves impose serious impacts on ecosystems, human health, agriculture, and energy consumption. Previous studies have classified heatwaves into independent daytime, independent nighttime, and compound daytime-nighttime types, and examined the long-term changes in the three types. However, the underlying mechanisms associated with the variations in different heatwave types remain poorly understood. Here we present the first investigation of the local physical processes associated with the daytime, nighttime, and compound heatwaves over the global land during 1979–2020. The results show that three heatwave types occur frequently and increasingly in most regions worldwide. Nighttime and compound heatwaves exhibit stronger increases in both frequency (the yearly number of the events) and fraction (the ratio of the yearly number of one heatwave type to the total yearly number of all types) than daytime heatwaves. Composite diagnostic analyses of local meteorological variables suggest that daytime heatwaves are associated with increased solar radiation under dry conditions and reduced cloud cover and humidity under a clear sky. In contrast, nighttime heatwaves are typically accompanied by moist conditions with increases in cloud fraction, humidity, and longwave radiation at night. These synoptic conditions for daytime and nighttime heatwaves are combined to contribute to compound heatwaves. Local divergences and moisture fluxes responsible for different heatwaves are further revealed. Positive moisture divergence anomalies are seen in most land areas for daytime and compound heatwaves, while they mainly appear in low latitudes for nighttime heatwaves. Our research provides a comprehensive understanding of the local mechanisms of different heatwave types, informing future risks and impact assessments.分析语言特征
06-08

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值