摘要:
P1589 [Usaco2005 Open] Muddy roads 泥泞的路 简单的模拟题。 给水坑排个序,蓝后贪心放板子。 注意边界细节。 1 #include<iostream> 2 #include<cstdio> 3 #include<cstring> 4 #include<algorit 阅读全文
摘要:
P2866 [USACO06NOV]糟糕的一天Bad Hair Day 奶牛题里好多单调栈..... 维护一个单调递减栈,存每只牛的高度和位置,顺便统计一下答案。 1 #include<iostream> 2 #include<cstdio> 3 #include<cstring> 4 using 阅读全文
摘要:
Description Farmer John's N (1 <= N <= 50,000) cows are standing in a very straight row and mooing. Each cow has a unique height h in the range 1..2,0 阅读全文
摘要:
Description Farmer John goes to Dollar Days at The Cow Store and discovers an unlimited number of tools on sale. During his first visit, the tools are 阅读全文
摘要:
P2863 [USACO06JAN]牛的舞会The Cow Prom 求点数$>1$的强连通分量数,裸的Tanjan模板。 1 #include<iostream> 2 #include<cstdio> 3 #include<cstring> 4 using namespace std; 5 int 阅读全文
摘要:
P2858 [USACO06FEB]奶牛零食Treats for the Cows 区间dp 设$f[l][r]$为取区间$[l,r]$的最优解,蓝后倒着推 $f[l][r]=max(f[l+1][r]+a[l]*p,f[l][r-1]+a[r]*p)$ 1 #include<iostream> 2 阅读全文