[贪心](JZOJ)【USACO Open 2012铜】岛屿Islands
2017-03-11 09:47
597 查看
题目描述
每当下雨时,FJ的牧场都会进水。由于牧场地面高低不平,被水淹没的地方不是很统一,形成一些岛屿。
FJ的牧场可描述成一个一维的地形图,由N(1 <= N <= 100,000)个彼此相连的柱状的高度值组成。高度值为H(1)…H(n)。假定这个地形图的两端有两条无限高的墙围着。
当雨一直下时,地形图上最低的区域先被水淹没,形成一些不相邻的岛屿。一旦水面高度到达一个区域的高度,则认为这个区域被淹没。
![](data:image/JPG;base64,/9j/4AAQSkZJRgABAQEAYABgAAD/2wBDAAgGBgcGBQgHBwcJCQgKDBQNDAsLDBkSEw8UHRofHh0aHBwgJC4nICIsIxwcKDcpLDAxNDQ0Hyc5PTgyPC4zNDL/2wBDAQkJCQwLDBgNDRgyIRwhMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjL/wAARCABzAawDASIAAhEBAxEB/8QAHwAAAQUBAQEBAQEAAAAAAAAAAAECAwQFBgcICQoL/8QAtRAAAgEDAwIEAwUFBAQAAAF9AQIDAAQRBRIhMUEGE1FhByJxFDKBkaEII0KxwRVS0fAkM2JyggkKFhcYGRolJicoKSo0NTY3ODk6Q0RFRkdISUpTVFVWV1hZWmNkZWZnaGlqc3R1dnd4eXqDhIWGh4iJipKTlJWWl5iZmqKjpKWmp6ipqrKztLW2t7i5usLDxMXGx8jJytLT1NXW19jZ2uHi4+Tl5ufo6erx8vP09fb3+Pn6/8QAHwEAAwEBAQEBAQEBAQAAAAAAAAECAwQFBgcICQoL/8QAtREAAgECBAQDBAcFBAQAAQJ3AAECAxEEBSExBhJBUQdhcRMiMoEIFEKRobHBCSMzUvAVYnLRChYkNOEl8RcYGRomJygpKjU2Nzg5OkNERUZHSElKU1RVVldYWVpjZGVmZ2hpanN0dXZ3eHl6goOEhYaHiImKkpOUlZaXmJmaoqOkpaanqKmqsrO0tba3uLm6wsPExcbHyMnK0tP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t5wmCWJOAB9a5jSYYrbxrfz2P2WSyvrVWke2XHlyxORhyGIZm8xucA/JjnHHV0UAFY/iC0s9Q0h7G+v8A7HBcMqLISgJbOQo3gqc46EHIzWxRQBzvhS0k03TrmwXY9vb3RS3nSFI/OQqrbiEAUkMzKSAM7fWuioooA5Pxkmh3NuLHU7mxhubgbYZJ5FEkK55lj3EYYdiOcgdcYrd0e2itNEsLaG6e5iito40nZtxkUKAHJ7k9c+9X6jYCMmQD6igCSuPSC2XxrYahpP2GaKWOa1uxbAb0P+s3uytz8yBeRwXPPOD2AIIyDkUzykznaKAH0yXyvJfzdvl4O7PTHengADAGBRQBzfgGVJfh/wCHvLdWKabbK2Gzg+UuQfeukoooA4T4lXmtweGtYgstINzp7aZOZrpbpYzEdj5+U8kKMNx16V2VnNNLaQSXMP2eZ41MkJcP5bEcruHBweM96s0UAFcXqo8N3viO1t0m06PU4ruKVpxIn2gMrbhGDnd82ApHPysRj07SigApkpRI2Z9oQA7iTgAd6fRQBxvhgS2PiXUrG2trZ9Ius30V1aptjVyI08oAErnC7iRjJOcc5PZUUUAFFFFABRRRQAUUUUAFFFFACZ+cDtg0tFFABRRRQA2T/Vt9KSH/AFS0UUAPooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKTPzgdsGiigBaKKKACmyf6tvpRRQAkP+qWn0UUAFFFFABRRRQAUUUUAFFFFABRRRQAUUUUAFFFFAH//2Q==)
左图,在当前水面时,有4个岛屿。右图,在水面升高后,剩下2个岛屿。显然,最终所有的区域都会沉入水面。
算出当雨从开始下到最后所有岛屿沉入水中,最多时可形成多少个岛屿。
分析
这个涉及到贪心(应该,不知道判断准不准)
经黄家旺标程和祝子扬指点后做出(友情链接那两位)
步骤一:将岛屿高度,岛屿下标(也不知道怎么形容了)搞些预处理
步骤二:因为岛屿高度后面要用,所以用c数组备份快排(排的其实是岛屿下标)
步骤三:按洪水进度,从高到低循环
【这里有两种情况:周围岛屿比中间这一个枚举到的高,那么岛屿数量加1;中间这个枚举到的比周围高,那么岛屿就少了一个(-1)】
大概就这样啦
每当下雨时,FJ的牧场都会进水。由于牧场地面高低不平,被水淹没的地方不是很统一,形成一些岛屿。
FJ的牧场可描述成一个一维的地形图,由N(1 <= N <= 100,000)个彼此相连的柱状的高度值组成。高度值为H(1)…H(n)。假定这个地形图的两端有两条无限高的墙围着。
当雨一直下时,地形图上最低的区域先被水淹没,形成一些不相邻的岛屿。一旦水面高度到达一个区域的高度,则认为这个区域被淹没。
左图,在当前水面时,有4个岛屿。右图,在水面升高后,剩下2个岛屿。显然,最终所有的区域都会沉入水面。
算出当雨从开始下到最后所有岛屿沉入水中,最多时可形成多少个岛屿。
分析
这个涉及到贪心(应该,不知道判断准不准)
经黄家旺标程和祝子扬指点后做出(友情链接那两位)
步骤一:将岛屿高度,岛屿下标(也不知道怎么形容了)搞些预处理
步骤二:因为岛屿高度后面要用,所以用c数组备份快排(排的其实是岛屿下标)
步骤三:按洪水进度,从高到低循环
【这里有两种情况:周围岛屿比中间这一个枚举到的高,那么岛屿数量加1;中间这个枚举到的比周围高,那么岛屿就少了一个(-1)】
大概就这样啦
#include <iostream> #include <cstdio> #include <cstring> using namespace std; int n,a[100001],b[100001],c[100001],i,j,s,m; void qs(int l,int h) { int i=l,j=h,mid=c[(l+h)/2],t; do { while (c[i]<mid) i++; while (c[j]>mid) j--; if (i<=j) { t=c[i];c[i]=c[j];c[j]=t; t=a[i];a[i]=a[j];a[j]=t; i++;j--; } } while (i<=j); if (i<h) qs(i,h); if (l<j) qs(l,j); } int main() { freopen("islands.in","r",stdin); freopen("islands.out","w",stdout); scanf("%d",&n); j=0; for (i=1;i<=n;i++) { scanf("%d",&s); if (s!=b[j]) { j++; b[j]=s; a[j]=j; } } memcpy(c,b,sizeof(b)); qs(1,n); s=1; for (i=1;i<=n;i++) { if (b[a[i]+1]>b[a[i]]&&b[a[i]-1]>b[a[i]]) s++; else if (b[a[i]+1]<=b[a[i]]&&b[a[i]-1]<=b[a[i]]) s--; if (s>m) m=s; } printf("%d",m); return 0; }
相关文章推荐
- jzoj P1540 【USACO Open 2012铜】岛屿Islands
- [搜索](JZOJ)【USACO Open 2012铜】三条直线Three Lines
- 【USACO Open 2012铜】三条直线Three lines (jzoj)
- [bzoj1572][Usaco2009 Open]工作安排Job_贪心_堆
- 【BZOJ】3016: [Usaco2012 Nov]Clumsy Cows(贪心)
- 【BZOJ4580】[Usaco2016 Open]248【区间DP】【或 贪心】
- jzoj P1542 【USACO Open 2012银】跑步Running laps
- BZOJ 2679: [Usaco2012 Open]Balanced Cow Subsets meet_in_the_middle / 折半搜索
- 【BZOJ4576】【BZOJ4580】【Usaco2016 Open】262144 贪心
- BZOJ2679: [Usaco2012 Open]Balanced Cow Subsets
- [BZOJ1572][Usaco2009 Open]工作安排Job(贪心+堆)
- BZOJ_1623:_[Usaco2008_Open]_Cow_Cars_奶牛飞车_(贪心)
- bzoj1747[Usaco2005 open]Expedition 探险 优先队列+贪心
- BZOJ_2679_[Usaco2012 Open]Balanced Cow Subsets _meet in middle+双指针
- BZOJ 1664 [Usaco2006 Open]County Fair Events 参加节日庆祝 贪心
- bzoj 1572: [Usaco2009 Open]工作安排Job【贪心+堆】
- bzoj 1623: [Usaco2008 Open]Cow Cars 奶牛飞车(贪心)
- JZOJ2935. 【USACO Open 2012 Gold Division】Balanced Cow Subsets
- [DP || 贪心 链表] BZOJ 4576 [Usaco2016 Open]262144 & BZOJ 4580 [Usaco2016 Open]248
- BZOJ2679: [Usaco2012 Open]Balanced Cow Subsets