传送门 还是一个字——栈 然后加一大堆特判 至少我是这么做的 我的代码 #include <cstdio> #include <iostream> #define N 100001 #define max(x, y) ((x) > (y) ? (x) : (y)) int s[N], a[N], b[N]; int n, top, ans; inline int read() { int x = 0, f = 1; char ch = getchar(); for(; !is…
P3668 [USACO17OPEN]Modern Art 2 现代艺术2 题目背景 小TY的同学HF也想创作艺术 HF只有一块长条状的画布(画条),所以每一次涂色只能涂上连续几个单位的颜料,同样新的颜料可以完全覆盖旧的颜料 由于他的颜料同样非常傲娇,每次涂完要等上1day才能完全干,只有旧颜料干了以后才能用新颜料覆盖 现在小HF用了2017个年头终于画出了一个大作品,自己非常满意 现在他想复制这份作品 题目描述 Having become bored with standard 2-dimen…
[LuoguP3668][USACO17OPEN]Modern Art2(Link) 现在你有一块长为\(N\)的画布,每次可以选择一段连续的区间进行颜色填涂,新颜色会覆盖旧颜色.每一次填涂都要耗费一天时间.在所有的填涂中每一种颜色只能用1次.求将画布变为目标序列的最小天数.如果不能完成填涂那么输出\(-1\). 首先我们要知道填涂的方式以及什么叫做填涂不合法. 上面的这个方案明显是合法的,我们先涂上"底色"\(Green\)然后再涂\(Red\)就好. 上面的这个情况,你发现无论怎么…
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 展…
Description Having become bored with standard 2-dimensional artwork (and also frustrated at others copying her work), the great bovine artist Picowso has decided to switch to a more minimalist, 1-dimensional style.Although, her paintings can now be d…
枚举$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[…
传送门 可以预处理出每种颜色的上下左右的位置,这样就框出来了一个个矩形,代表每种颜色分别涂了哪里. 然后用二维的差分. 就可以求出来每个位置至少涂了几次,如果 > 1 的话,就肯定不是先涂的, 如果是1的话,并且不是只有一种颜色,那么也有可能是先涂的, 如果只有一种颜色,并且 n != 1,那么一定不是先涂的,如果 n == 1,也就只有一种颜色了,那么它就是先涂的 #include <cstdio> #include <cstring> #include <iostr…
Text I am an art student and I paint a lot of pictures. Manay people pretend that they understand modern art. They always tell you what a picture is 'about'. Of course, many pictures are not about anything. They are just pretty partterns. We like the…
Text I had a letter from my sister yesterday. She lives in Nigeria. In her letter, she said that she would come to England next year. If she comes, she will get a surprise. We are now living in a beautiful new house in the country. Work on it had beg…