bzoj4009: [HNOI2015]接水果

esxi8.0.3如何添加USB外置硬盘 本文介绍了在ESXi系统中配置外置USB硬盘作为数据存储的完整步骤:1)通过SSH禁用USB仲裁服务并关闭自启;2)识别已连接的USB硬盘设备路径;3)使用partedUtil创建GPT分区表并计算扇区范围;4)设置VMFS6分区并格式化。关键命令包括停止usbarbitrator服务、partedUtil分区操作以及vmkfstools格式化命令。整个过程需通过SSH执行,最终将USB硬盘配置为名为"USB_Datastore"的VMFS6存储设备。 阅读详情

传送门:http://www.lydsy.com/JudgeOnline/problem.php?id=4009

思路:先给定一些路径,每个路径有一个权值。

题目要求的是对于一个路径,它的子路径中权值第k大的是多少


首先我们观察一个盘子(u,v),它能接到哪些水果呢?

分情况:如果u!=lca(u,v)

那么水果的两端点(a,b)就在盘子两端点的子树中

用dfs序来表示,就是dfn[u]<=a<=last[u],dfn[v]<=b<=last[v]

last[i]表示i的子树的最大 dfn

如果u==lca(u,v)

这时稍微有一些区别,w表示u的儿子且是v的祖先的点,注意不是u

那么b还是在v子树中,a在除了w子树之外的所有点中

dfn[v]<=b<=last[v],1<=a<=dfn[w]-1||last[w]+1<=a<=n


这时,盘子就成了一个或两个矩形,水果就是点

问题就是求覆盖一个点的矩形中权值第k大的权值是多少》

扫描线+整体二分就可以了

我们先将矩形按权值从小到大排序

然后对于一个点,如果[l,mid]中能覆盖这个点的矩形数不小于k,则说明答案在[l,mid]中

否则在[mid+1,r],同时k减去覆盖的矩形数


#include<cstdio>
#include<cstring>
#include<iostream>
#include<algorithm>
const int maxn=80010,maxk=18;
using namespace std;
int n,m,q,cnt,fa[maxn][maxk],dfn[maxn],tim,last[maxn],dep[maxn],ans[maxn],sum[maxn];
int pre[maxn],now[maxn],son[maxn],tot;
struct Plate{int xd,xu,yd,yu,v;}plate[maxn];
struct Event{int x,yd,yu,v,id;}event[maxn];
struct Poi{int x,y,k,id;}poi[maxn],tmp1[maxn],tmp2[maxn];
bool operator <(Plate a,Plate b){return a.v<b.v;}
bool operator <(Event a,Event b){return a.x==b.x?a.id<b.id:a.x<b.x;}
void add(int a,int b){pre[++tot]=now[a],now[a]=tot,son[tot]=b;}

struct Bit{
	int val[maxn];
	void modify(int l,int r,int v){
		for (int i=l;i<=n;i+=(i&(-i))) val[i]+=v;
		for (int i=r+1;i<=n;i+=(i&(-i))) val[i]-=v;
	}
	int query(int x){int res=0;for (;x;x-=(x&(-x))) res+=val[x];return res;}
}T;

void dfs(int x){
	dfn[x]=++tim;
	for (int i=0;fa[x][i];i++) fa[x][i+1]=fa[fa[x][i]][i];
	for (int y=now[x];y;y=pre[y]) if (son[y]!=fa[x][0])
		fa[son[y]][0]=x,dep[son[y]]=dep[x]+1,dfs(son[y]);
	last[x]=tim;
}
int jump(int a,int h){for (int i=16;h;i--) if (h>=(1<<i)) h-=(1<<i),a=fa[a][i];return a;}
int lca(int a,int b){
	if (dep[a]<dep[b]) swap(a,b);
	a=jump(a,dep[a]-dep[b]);
	if (a==b) return a;
	for (int i=16;i>=0;i--) if (fa[a][i]!=fa[b][i]) a=fa[a][i],b=fa[b][i];
	return fa[a][0];
}

void solve(int l,int r,int st,int ed){
	if (st>ed) return; 
	if (l==r){
		for (int i=st;i<=ed;i++) ans[poi[i].id]=plate[l].v;
		return;
	}
	int mid=(l+r)>>1,siz=0;
	for (int i=l;i<=mid;i++){
		event[++siz]=(Event){plate[i].xd,plate[i].yd,plate[i].yu,1,0};
		event[++siz]=(Event){plate[i].xu,plate[i].yd,plate[i].yu,-1,n+1};
	}
	for (int i=st;i<=ed;i++) event[++siz]=(Event){poi[i].x,poi[i].y,0,0,i};
	sort(event+1,event+1+siz);
	for (int i=1;i<=siz;i++) 
		if (st<=event[i].id&&event[i].id<=ed) sum[event[i].id]=T.query(event[i].yd);
		else T.modify(event[i].yd,event[i].yu,event[i].v);
	int a=0,b=0;
	for (int i=st;i<=ed;i++) 
		if (sum[i]>=poi[i].k) tmp1[++a]=poi[i];
		else tmp2[++b]=(Poi){poi[i].x,poi[i].y,poi[i].k-sum[i],poi[i].id};
	for (int i=st;i<=st+a-1;i++) poi[i]=tmp1[i-st+1];
	for (int i=st+a;i<=ed;i++) poi[i]=tmp2[i-st-a+1];
	solve(l,mid,st,st+a-1),solve(mid+1,r,st+a,ed);
}

int main(){
	scanf("%d%d%d",&n,&m,&q);
	for (int i=1,a,b;i<n;i++) scanf("%d%d",&a,&b),add(a,b),add(b,a);
	dfs(1);
	for (int i=1,a,b,c,u;i<=m;i++){
		scanf("%d%d%d",&a,&b,&c);u=lca(a,b);
		if (dfn[a]>dfn[b]) swap(a,b);
		if (u!=a) plate[++cnt]=(Plate){dfn[a],last[a],dfn[b],last[b],c};
		else{
			int w=jump(b,dep[b]-dep[a]-1);
			plate[++cnt]=(Plate){1,dfn[w]-1,dfn[b],last[b],c};
			if (last[w]<n) plate[++cnt]=(Plate){dfn[b],last[b],last[w]+1,n,c};
		}
	}
	sort(plate+1,plate+1+cnt);
	for (int i=1,a,b,k;i<=q;i++){
		scanf("%d%d%d",&a,&b,&k);
		if (dfn[a]>dfn[b]) swap(a,b);
		poi[i]=(Poi){dfn[a],dfn[b],k,i};
	}
	solve(1,cnt,1,q);
	for (int i=1;i<=q;i++) printf("%d\n",ans[i]);
	return 0;
}




Verilog 并行 FIR 滤波器设计 FIR(Finite Impulse Response)滤波器是一种有限长单位冲激响应滤波器,又称为非递归型滤波器。FIR 滤波器具有严格的线性相频特性,同时其单位响应是有限长的,因而是稳定的系统,在数字通信、图像处理等领域都有着广泛的应用。 阅读详情

相关推荐

LauterBach使用教程

(也就是服务器上编译时候的路径一模一样的路径,选中到工程目录就可以)4.选择自己板子对应的cpu(可以直接界面选择也可以命令行的方式)(cpu里的system setting),我们板子需要sys复位,所以选择sys。注:一般情况下运行状态不可以修改外设寄存器的值,但是可以通过修改配置来修改为运行时可修改(cpu寄存器则不可以)(修改这个配置,运行时也可以查看代码)注意:lauterbach可以使用命令来操作,但是由于本人刚刚使用,目前基本上使用的都是界面的按钮,以后会陆续学习命令行指令和脚本的方式。

wacebb的博客 1万+

BZOJ 离线网站

https://acm.taifua.com/bzoj/index.html https://lydsy.download/archive/ http://lbn187.is-programmer.com/posts/103404.html 转载于:https://www.cnblogs.com/Agnel-Cynthia/p/10614287.html

689

logisim计组实验八 乘法器

原理:点这里 有问题欢迎留言哦~ 文章目录五位阵列乘法器电路图时间延迟分析六位补码阵列乘法器五位无符号乘法流水线原理图电路图原码一位乘法器原理图电路图补码一位乘法器 五位阵列乘法器 电路图 此处注意:全加器FA的cout端是进位端而非输出端 使用硬件控制比循环累加的速度快得多。 但是存在串行进位链 改进版: 时间延迟分析 T是计算相加数的一级门延迟 3n–>2n 性能差别在1.5倍 ...

treblez's blog 2万+

【BZOJ4009_洛谷3242】[HNOI2015] 接水果(整体二分)

题目: 洛谷 3242 分析: 明确题意:在一棵树上给定若干权值为 \(w\) 的路径 \((u,v)\) (盘子),每次给定 \((a,b)\) (水果),询问所有满足 \((u,v)\) 被 \((a,b)\) 完全覆盖的路径中第 \(k\) 小的路径的权值。 先考虑如何快速判断 \((u,v)\) 是不是 \((a,b)\) 的子路径。第一反应是充要条件是 \(a\) 和 \(b\) 分别在...

weixin_30564901的博客 224

【信号与系统实战解析】—— 拉普拉斯变换在电路分析中的关键应用

本文深入解析了拉普拉斯变换在电路分析中的关键应用。通过将时域微分方程转换为复频域的代数方程,系统化处理初始条件,并利用零极点图分析电路稳定性与频率响应。文章以RLC串联电路为例,详细演示了s域建模、性质运用及综合分析方法,为工程师提供了分析动态电路的强大工具与清晰视角。

weixin_29093017的博客 174

手把手教你编写I2C读写EEPROM代码(驱动层实现)

从底层寄存器配置到时序控制,详解如何编写可移植的I2C读写EEPROM代码,覆盖起始信号、地址帧、数据收发及ACK应答等关键环节,确保在STM32、ESP32等主流平台稳定运行,真正落地i2c读写eeprom代码需求。

weixin_35756130的博客 508

「HNOI2015」接水果 - 题解

「HNOI2015」接水果 题意: 给你一个树上路径集合$ S $ ,每条路径有个权值。每次询问一条路径 $ (x, y) $ ,问它在 $ S $ 中包含的路径中权值第 $ k $ 小的是多少。 做法: 首先考虑如何判断判断一条路径是否被另一条路径包含。 当一条路径 $ (x, y) (dep_x < dep_y) $ 是一条深度从浅到深的链时,路径 $ (u, v) (dep_u &lt...

weixin_30709809的博客 137

计算机等级考试(二级WPS)---真题14套

目录 真题14一、选择题二、WPS文字三、WPS表格四、WPS演示21.打开考生文件夹下的素材文档 “WPS.docx”(.docx 为文件扩展名),后续操作均基于此文件,否则不得分。小周正在整理一份关于极光的文档,请按要求帮助她完成文档的排版工作。1.将全文中的手动换行符全部替换为中文句号并回车,删除文中的空行和空格。2.将正文第 2 段(“在我國的古書…… 極光”)中的繁体字转换成简体字,并为其设置 “正文” 样式。3.对文档样式进行如下设置:4.为 “1.3 极光的形态” 一节中列出的五种极光形态特征

2401_82750246的博客 1179

P3242 [HNOI2015] 接水果(整体二分、扫描线、dfs序)

比较综合的整体二分应用

BUG_Creater_jie的博客 239

【雕爷学编程】Arduino智慧交通之RF24通信实现车队之间的实时通信和协调

通过这些示例,车队领导可以发送指令给车队成员,车队成员可以接收指令并执行相应的操作,同时车队成员也可以发送自己的位置信息给车队领导或其他成员,以实现车队之间的实时通信和协调。例如,在高速公路上,车队中的车辆可以根据前方车辆的速度和位置信息,自动调整自身的速度和距离,以保持车队的整体稳定和安全。Arduino智慧交通系统利用RF24通信模块实现车队之间的实时通信和协调,通过无线通信技术,车辆之间可以实时传输数据和指令,以实现车队的协同行驶和交通优化。通过数据处理和分析,可以生成实时的交通信息和统计数据。

雕爷学编程 1075

JavaSwing_1.1: FlowLayout(流式布局)

FlowLayout,流式布局管理器。按水平方向依次排列放置组件,排满一行,换下一行继续排列。

谢TS的博客 7万+

BZOJ4009:[HNOI2015]接水果

浅谈树状数组与线段树:https://www.cnblogs.com/AKMer/p/9946944.html 题目传送门:https://www.lydsy.com/JudgeOnline/problem.php?id=4009 把每个水果\((u,v)\)转化成平面上的一个点\((dfn[u],dfn[v])\)。 我们考虑一个盘子,它可以接的水果的点集应该是矩形状的。 假设盘子的两...

aga28832的博客 143

杰理AC696N系列芯片,烧录的时候烧录器连接上芯片之后电脑显示无法识别该设备,该怎么解决?

🏆 本文收录于《全栈Bug调优(实战版)》专栏,致力于分享我在项目实战过程中遇到的各类Bug及其原因,并提供切实有效的解决方案。无论你是初学者还是经验丰富的开发者,本文将为你指引出一条更高效的Bug修复之路,助你早日登顶,迈向财富自由的梦想🚀!同时,欢迎大家关注、收藏、订阅本专栏,更多精彩内容正在持续更新中。让我们一起进步,Up!Up!Up!    备注: 部分问题/难题源自互联网,经过精心筛选和整理,结合数位十多年大厂实战经验资深大佬经验总结所得,数条可行方案供所需之人参考。

**My Coding Family** 1714

BZOJ4009: [HNOI2015]接水果

BZOJ4009: [HNOI2015]接水果 由于$BZOJ$上经常有人拿这道题卡评测姬,所以变成了权限题。。。 本蒟蒻表示没钱氪金。。。 这里附上洛谷的体面: P3242 [HNOI2015]接水果 题目描述 风见幽香非常喜欢玩一个叫做 osu!的游戏,其中她最喜欢玩的模式就是接水果。由于她已经DT FC 了The big black, 她觉得这个游戏太简单了,于是发明了一个更加难...

weixin_30289831的博客 197

IEM模型,地表粗糙度模拟

利用微波反演土壤水分时候,利用IEM模型可以实现对随机地表的模拟

深度学习工具包 DeepLearningToolbox

深度学习工具包Deprecation notice.-----This toolbox is outdated and no longer maintained.There are much better tools available for deep learning than this toolbox, e.g. [Theano](http://deeplearning.net/software/theano/), [torch](http://torch.ch/) or [tensorflow](http://www.tensorflow.org/)I would suggest you use one of the tools mentioned above rather than use this toolbox.Best, Rasmus.DeepLearnToolbox================A Matlab toolbox for Deep Learning.Deep Learning is a new subfield of machine learning that focuses on learning deep hierarchical models of data.It is inspired by the human brain's apparent deep (layered, hierarchical) architecture.A good overview of the theory of Deep Learning theory is[Learning Deep Architectures for AI](http://www.iro.umontreal.ca/~bengioy/papers/ftml_book.pdf)For a more informal introduction, see the following videos by Geoffrey Hinton and Andrew Ng.* [The Next Generation of Neural Networks](http://www.youtube.com/watch?v=AyzOUbkUf3M) (Hinton, 2007)* [Recent Developments in Deep Learning](http://www.youtube.com/watch?v=VdIURAu1-aU) (Hinton, 2010)* [Unsupervised Feature Learning and Deep Learning](http://www.youtube.com/watch?v=ZmNOAtZIgIk) (Ng, 2011)If you use this toolbox in your research please cite [Prediction as a candidate for learning deep hierarchical models of data](http://www2.imm.dtu.dk/pubdb/views/publication_details.php?id=6284)```@MASTERSTHESIS\{IMM2012-06284, author = "R. B. Palm", title = "Prediction as a candidate for learning deep hierarchical models of data", year = "2012",}```Contact: rasmusbergpalm at gmail dot comDirectories included in the toolbox-----------------------------------`NN/` - A library for Feedforward Backpropagation Neural Networks`CNN/` - A library for Convolutional Neural Networks`DBN/` - A library for Deep Belief Networks`SAE/` - A library for Stacked Auto-Encoders`CAE/` - A library for Convolutional Auto-Encoders`util/` - Utility functions used by the libraries`data/` - Data used by the examples`tests/` - unit tests to verify toolbox is workingFor references on each library check REFS.mdSetup-----1. Download.2. addpath(genpath('DeepLearnToolbox'));Example: Deep Belief Network---------------------```matlabfunction test_example_DBNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit RBM and visualize its weightsrand('state',0)dbn.sizes = [100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);figure; visualize(dbn.rbm{1}.W'); % Visualize the RBM weights%% ex2 train a 100-100 hidden unit DBN and use its weights to initialize a NNrand('state',0)%train dbndbn.sizes = [100 100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);%unfold dbn to nnnn = dbnunfoldtonn(dbn, 10);nn.activation_function = 'sigm';%train nnopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.10, 'Too big error');```Example: Stacked Auto-Encoders---------------------```matlabfunction test_example_SAEload mnist_uint8;train_x = double(train_x)/255;test_x = double(test_x)/255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit SDAE and use it to initialize a FFNN% Setup and train a stacked denoising autoencoder (SDAE)rand('state',0)sae = saesetup([784 100]);sae.ae{1}.activation_function = 'sigm';sae.ae{1}.learningRate = 1;sae.ae{1}.inputZeroMaskedFraction = 0.5;opts.numepochs = 1;opts.batchsize = 100;sae = saetrain(sae, train_x, opts);visualize(sae.ae{1}.W{1}(:,2:end)')% Use the SDAE to initialize a FFNNnn = nnsetup([784 100 10]);nn.activation_function = 'sigm';nn.learningRate = 1;nn.W{1} = sae.ae{1}.W{1};% Train the FFNNopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.16, 'Too big error');```Example: Convolutional Neural Nets---------------------```matlabfunction test_example_CNNload mnist_uint8;train_x = double(reshape(train_x',28,28,60000))/255;test_x = double(reshape(test_x',28,28,10000))/255;train_y = double(train_y');test_y = double(test_y');%% ex1 Train a 6c-2s-12c-2s Convolutional neural network %will run 1 epoch in about 200 second and get around 11% error. %With 100 epochs you'll get around 1.2% errorrand('state',0)cnn.layers = { struct('type', 'i') %input layer struct('type', 'c', 'outputmaps', 6, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %sub sampling layer struct('type', 'c', 'outputmaps', 12, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %subsampling layer};cnn = cnnsetup(cnn, train_x, train_y);opts.alpha = 1;opts.batchsize = 50;opts.numepochs = 1;cnn = cnntrain(cnn, train_x, train_y, opts);[er, bad] = cnntest(cnn, test_x, test_y);%plot mean squared errorfigure; plot(cnn.rL);assert(er<0.12, 'Too big error');```Example: Neural Networks---------------------```matlabfunction test_example_NNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);% normalize[train_x, mu, sigma] = zscore(train_x);test_x = normalize(test_x, mu, sigma);%% ex1 vanilla neural netrand('state',0)nn = nnsetup([784 100 10]);opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samples[nn, L] = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.08, 'Too big error');%% ex2 neural net with L2 weight decayrand('state',0)nn = nnsetup([784 100 10]);nn.weightPenaltyL2 = 1e-4; % L2 weight decayopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex3 neural net with dropoutrand('state',0)nn = nnsetup([784 100 10]);nn.dropoutFraction = 0.5; % Dropout fraction opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex4 neural net with sigmoid activation functionrand('state',0)nn = nnsetup([784 100 10]);nn.activation_function = 'sigm'; % Sigmoid activation functionnn.learningRate = 1; % Sigm require a lower learning rateopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex5 plotting functionalityrand('state',0)nn = nnsetup([784 20 10]);opts.numepochs = 5; % Number of full sweeps through datann.output = 'softmax'; % use softmax outputopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex6 neural net with sigmoid activation and plotting of validation and training error% split training data into training and validation datavx = train_x(1:10000,:);tx = train_x(10001:end,:);vy = train_y(1:10000,:);ty = train_y(10001:end,:);rand('state',0)nn = nnsetup([784 20 10]); nn.output = 'softmax'; % use softmax outputopts.numepochs = 5; % Number of full sweeps through dataopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, tx, ty, opts, vx, vy); % nntrain takes validation set as last two arguments (optionally)[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');```[![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/rasmusbergpalm/deeplearntoolbox/trend.png)](https://bitdeli.com/free "Bitdeli Badge")

BZOJ 4009: [HNOI2015]接水果

4009: [HNOI2015]接水果 Time Limit:60 SecMemory Limit:512 MBSubmit:636Solved:300[Submit][Status][Discuss] Description 风见幽香非常喜欢玩一个叫做 osu!的游戏,其中她最喜欢玩的模式就是接水果。 由于她已经DT FC 了The big black, 她觉得...

weixin_30917213的博客 143

霍尼韦尔SoftMaster使用说明

霍尼韦尔SoftMaster使用说明

bzoj 4009: [HNOI2015]接水果

Description风见幽香非常喜欢玩一个叫做 osu!的游戏,其中她最喜欢玩的模式就是接水果。由于她已经DT FC 了The big black,  她觉得这个游戏太简单了,于是发明了一个更加难的版本。首先有一个地图,是一棵由 n 个顶点、n-1 条边组成的树(例如图 1给出的树包含 8 个顶点、7 条边)。这颗树上有 P 个盘子,每个盘子实际上是一条路径(例如图 1 中顶点 6 到顶点 8 ...

Rising_shit的博客 409

VB摄像头监控

该VB模块可对摄像头捕获的画面进行录像等,可在创建的窗口进行控制

BZOJ4009:[HNOI2015]接水果

Description 风见幽香非常喜欢玩一个叫做 osu!的游戏,其中她最喜欢玩的模式就是接水果。由于她已经DT FC 了The big black, 她觉得这个游戏太简单了,于是发明了一个更加难的版本。首先有一个地图,是一棵由 n 个顶点、n-1 条边组成的树(例如图 1给出的树包含 8 个顶点、7 条边)。这颗树上有 P 个盘子,每个盘子实际上是一条路径(例如图 1 中顶点 6...

weixin_30585437的博客 78

BZOJ4009 : [HNOI2015]接水果

对于一条路径x-y: ·若x与y成祖先-孩子关系,假设y是x的祖先,z是y到x方向的第一个节点,则包含它的路径满足:起点在x的子树里,且终点不在z的子树里。 ·若x与y不成祖先-孩子关系,则包含它的路径满足:起点在x的子树里,且终点在y的子树里。 于是每个盘子可以拆成一个或两个矩形,每个水果可以当成两个点。 整体二分的时候扫描线+树状数组维护,时间复杂度$O(n\log^2n)$。   ...

weixin_34268610的博客 108

bzoj4009: [HNOI2015]接水果【整体二分+扫描线】

Description 风见幽香非常喜欢玩一个叫做 osu!的游戏,其中她最喜欢玩的模式就是接水果。由于她已经DT FC 了The big black, 她觉得这个游戏太简单了,于是发明了一个更加难的版本。首先有一个地图,是一棵由 n 个顶点、n-1 条边组成的树(例如图 1给出的树包含 8 个顶点、7 条边)。这颗树上有 P 个盘子,每个盘子实际上是一条路径(例如图 1 中顶点 6 到顶点 ...

cdsszjj的博客 398

BZOJ 3772: 精神污染 (dfs序+树状数组)

跟 BZOJ 4009: [HNOI2015]接水果一样… CODE #include <set> #include <queue> #include <cctype> #include <cstdio> #include <cstring> #include <algorithm> using namespace std; ...

Ark 416

BZOJ4009 & 洛谷3242 & LOJ2113:[HNOI2015]接水果——题解

https://www.lydsy.com/JudgeOnline/problem.php?id=4009 https://www.luogu.org/problemnew/show/P3242 https://loj.ac/problem/2113 风见幽香非常喜欢玩一个叫做 osu!的游戏,其中她最喜欢玩的模式就是接水果。由于她已经DT FC 了The big black, 她觉...

weixin_33768481的博客 154
上一篇: bzoj4012: [HNOI2015]开店
下一篇: bzoj4011: [HNOI2015]落忆枫音
thy_asdf
博客等级 码龄12年 16粉丝 186原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

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

抵扣说明:

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

余额充值