枚举$T_1$的树根,然后DP,设$f[i][j]$表示$T_1$的子树$i$是否存在包括i的连通子树与$T_2$的子树$j$同构. 若$j$是叶子,那么显然可以. 若$deg_i<deg_j$,那么显然不可以. 否则将$i$与$j$所有互相同构的儿子之间连边,二分图匹配判断是否存在完美匹配即可. #include<cstdio> #include<algorithm> const int N=105; int T,C,n,m,o,i,j,k,x,y; int g[N],v[…
4780: [Usaco2017 Open]Modern Art 2 Time Limit: 10 Sec Memory Limit: 128 MB Description Having become bored with standard 2-dimensional artwork (and also frustrated at others copying her w ork), the great bovine artist Picowso has decided to switch t…
lesson18 Electric currents in modern art electricity n. 电力:电流; electric adj. 电的:电动的; electronic adj. 电子的 current n. (水,气,电)流 fail to do (想尽了办法)未能做某事 be used to doing 适应... so-called 有点贬义的意思 exhibition n. 展览,显示:展览会: hold an exhibition 举办一个展会 exhibit 展…
P3668 [USACO17OPEN]Modern Art 2 现代艺术2 题目背景 小TY的同学HF也想创作艺术 HF只有一块长条状的画布(画条),所以每一次涂色只能涂上连续几个单位的颜料,同样新的颜料可以完全覆盖旧的颜料 由于他的颜料同样非常傲娇,每次涂完要等上1day才能完全干,只有旧颜料干了以后才能用新颜料覆盖 现在小HF用了2017个年头终于画出了一个大作品,自己非常满意 现在他想复制这份作品 题目描述 Having become bored with standard 2-dimen…
Andrew and Chemistry Description During the chemistry lesson Andrew learned that the saturated hydrocarbons (alkanes) enter into radical chlorination reaction. Andrew is a very curious boy, so he wondered how many different products of the reaction m…
题意:给定一棵n个点的树,问删去某个点之后所有的树同构,这样分割出来的树最多能有几棵 n<=4000 思路:分割成至少两个size相等的联通块之后size必定小于n/2,与树的重心的定义相同 预处理出重心(0,1或2个)之后上无根树同构板子 #include<bits/stdc++.h> using namespace std; typedef long long ll; typedef unsigned int uint; typedef unsigned long long ull;…