还以为是dp呢 首先默认答案是n 对于一个影子,如果前边的影子比它高则可以归进前面的影子,高处的一段单算: 和他一样高的话就不用单算了,ans--: 否则入栈 #include<iostream> #include<cstdio> #include<algorithm> using namespace std; const int N=50005; int n,m,ans,top,h[N],s[N]; int read() { int r=0,f=1; char p=g…
1628: [Usaco2007 Demo]City skyline Time Limit: 5 Sec Memory Limit: 64 MBSubmit: 256 Solved: 210[Submit][Status] Description The best part of the day for Farmer John's cows is when the sun sets. They can see the skyline of the distant city. Bessie w…
1645: [Usaco2007 Open]City Horizon 城市地平线 Time Limit: 5 Sec Memory Limit: 64 MBSubmit: 315 Solved: 157[Submit][Status] Description Farmer John has taken his cows on a trip to the city! As the sun sets, the cows gaze at the city horizon and observe t…
BZOJ_1654_[Usaco2007 Open]City Horizon 城市地平线_扫描线 Description N个矩形块,交求面积并. Input * Line 1: A single integer: N * Lines 2..N+1: Input line i+1 describes building i with three space-separated integers: A_i, B_i, and H_i Output * Line 1: The total area,…
[BZOJ1645][Usaco2007 Open]City Horizon 城市地平线 Description Farmer John has taken his cows on a trip to the city! As the sun sets, the cows gaze at the city horizon and observe the beautiful silhouettes formed by the rectangular buildings. The entire ho…