CF573C Bear and Drawing 构造+树论

时间:2023-12-25 17:16:25

正解:构造

解题报告:

传送门!

这题首先可以画下图找下规律,,,然后通过找规律可以发现,最终的方案一定是一条主干+一些枝条,而且这些枝条的分杈一定小于等于2

明确一下主干的定义,最左边的节点和最右边的节点之间的路径为主干

如图

aaarticlea/png;base64,iVBORw0KGgoAAAANSUhEUgAAAbsAAABGCAIAAADacK06AAAgAElEQVR4Ae3dB5gdVdkH8EmCEMF80gmoYQMqkV6kKCBFkWIIReJHUQyIKE0BpYjyCBYe+UDU0BRQAhZAQaQkgHRpYgARaUKUUESqCWKAhHK/3+wJs5N7786dmTu72Q33PPfZnXLm1Pf8z9vOOUNqtVrUCZ0W6LRApwU6LZCjBYbmiNOJ0mmBTgt0WqDTAnELLNRphoHZAgnrP2TIwCxgp1SdFngrtkAHMQdirwe4fO216Pnno/vvj2bOjODm0KHRsstGG24YFziB0eRiIFajU6ZOC+RrgUHEH3QQM1+X9mMs1OP3wgvRHXdEF14Y3X139O9/x9kPGxaNGhXtsEO0wQbR2mvHt+BSzA5o9mPn9GFWjajR+KQPs++XpJMavf56TLpJwA0g40FByUM6lp+k2+b7RaAhxHTffdE3vxk9/nj0wAPR7NnRG2/MLdrb3hYtuWT0gQ9EW20V7bpr1NU1aOhsvrftwC+A3tf1r74a/w3Y4e/w4T04UiGgJGhVYZrZLZzkqIJ+Z5wR3XNPXFPPl18+2mWXaLXVore/fRDQcwcxszu6X9+iHpI4uNxzz1gYd5tgZbocJuSllorjHHpoNHJkLK13wuBtgQAlOvqVV6K77opOOSV66KFYgBDe+95o4sRoscVi3Ay93D7AJdmhtJdf7iGwhReOAStNS+3nle6UQNsvvRRdfnl09tnRX/4S/ec/MYX7qR163muvaI89ove8J1ISodrc0yVp87qDmG02YJPPS7Pt5t7bb4/23XfIgw82Sbbu0f/8T/T5z9e+9rWY66w2DBmw1FptPQdGarASjkCQn/88OvPMHggLpVt88WjCBB0dQ8k73hE/a6dzwJPsSC3PPhv9/vfR974X/fO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p4IJ8ItJgRKAJ497YjhGeUNvI+/ZEYMRGCrcTo4awccCgOH68moRctXoZqYTYw8MwbeOSxpCXKxsw/5Hmhht51QrgXAhA9Zydmdd911V1tUdMvvJNY1cZqvvbbx7NlWptcLsDZRHj6cgvmwKGKbmz/qS5hoF0u73rHqcAxizKnWtlyuPX3VQczSTdf5sA9bIIBpTKD1w7kPM12Akw7Q2d2ecxvUk0svjTUeU6cOoZEIDU7B5eBoe1rTNZme8Xfzt00aiz1/yxM3YFKm+V6UTgE6LdBpgX5rgQCRLEa2zQ6LzT3hqTphQo97wPwGzH5rjAIZdRCzQGN1onZaYAFrgYCbaWQMT1Qz/XABq3U71ekgZjut1/m2RQs0SjBB0Gt83iKhZq/nu8zYrFCdZwt4C5T0YF/AW6VTvT5rgUqwss9K10m40wItWqBjhmzRQJ3XnRbotECnBZIW6CBm0hSdi04LdFqg0wItWmChO5+q6MCnFhl1Xr8VW6BPZfCOHrMqkmrwIZr3wbx3VWU6SNP5f/DwNMlZu1djAAAAAElFTkSuQmCC" alt="" />

强行证明一下吼,,,

因为是两排平行的“钉子板”

所以如果一个分枝点想要有超过2个儿子结点

因为在同侧最多有两条边

就一定要往另一边伸至少一条边

这样就因为这条边挡住了一侧(比如说左侧)

那么剩下的边只能往右侧伸展了

那它向另一侧伸的边伸出的子树中的叶子节点一定有一个是最左边的节点

那最左边的节点的路径一定要经过它

所以它就在最左边的节点到最右边的节点的路上

它就是主干不是分枝辣

然后就考虑,我怎么找哪个是杈哪个是主干呐

那就从叶子节点开始,把链减下来,剩下的不是主干就是分杈点

然后就看,如果这个点麻油被减下来的邻居只有一个,说明那它就是分叉点或者主干点的最侧端

然后最后判断一下484所有主干的邻居主干点都小于等于2就好辣!

(最后分享一个傻逼错误,,,给大家提个醒,,,虽然我jio得不会有人和我一样蠢地犯这个错误QAQ

就是,我jio得这题过程中有很多次要算size,所以我就预处理了下sz存了下来

但是,我是一遍算sz一遍dfs

然后这就会导致,在dfs的时候可能会dfs到还麻油算sz的点

就会错误地删掉

就WA了,,,

我说开始错的时候找评测记录怎么一直没找到和我一样WA在第五个点的,,,原来是这个错误太sd辣一般人不会犯呜呜呜,,,

#include<bits/stdc++.h>
using namespace std;
#define ll int
#define il inline
#define rg register
#define rp(i,x,y) for(rg ll i=x;i<=y;++i)
#define my(i,x,y) for(rg ll i=x;i>=y;--i) const ll N=+;
ll n,sz[N],lg[N];
bool del[N];
vector<ll>ed[N]; il ll read()
{
rg char ch=getchar();rg ll x=;rg bool y=;
while(ch!='-' && (ch>'' || ch<''))ch=getchar();
if(ch=='-')ch=getchar(),y=;
while(ch<='' && ch>='')x=(x<<)+(x<<)+(ch^''),ch=getchar();
return y?x:-x;
}
il void dfs(ll nw,ll sn){if(sz[nw]<=){del[nw]=;rp(i,,sz[nw]-)if(ed[nw][i]!=sn)dfs(ed[nw][i],nw);}} int main()
{
n=read();rp(i,,n-){ll x=read(),y=read();ed[x].push_back(y);ed[y].push_back(x);}
rp(i,,n)sz[i]=ed[i].size();rp(i,,n)if(sz[i]==)dfs(i,);
rp(i,,n)rp(j,,sz[i]-)if(del[ed[i][j]])++lg[i];
rp(i,,n)
if(!del[i])
{
ll cnt=;
rp(j,,sz[i]-)if(sz[ed[i][j]]-min(lg[ed[i][j]],)> && (!del[i]))++cnt;
if(cnt>)return printf("No"),;
}
return printf("Yes"),;
} 这儿是代码!