poj2091-Zing Zhu's Oyster Farm
来源:互联网 发布:java 100以内的质数 编辑:程序博客网 时间:2024/06/05 19:10
Zing Zhu's Oyster Farm
Time Limit: 3000MS Memory Limit: 30000KTotal Submissions: 270 Accepted: 71
Description
Zing Zhu owns an island that is a piece of flat land. Everyday, when the tide rises, the island is flooded by sea water. After much thinking and asking advice from members of his family, Zing Zhu decided to set up an oyster farm in the island. Zing Zhu uses a sophisticated system of plastic watertight modular fences to control the areas that will be flooded and the areas that will not be flooded during the rise of the tide. The fences used by Zing Zhu are either horizontal or vertical and come in strips that have different lengths and heights. Two fences can intersect in at most one point, not necessarily in their ends.
You have been contacted by Zing Zhu to calculate, given the height the tide will reach and the position and height of all fence strips, the total area of land which will not be flooded during the high tide. You may assume that the widths of fence strips are so thin compared to the size
of the land that, for the purpose of calculating the total area, fence strips may be considered as having widths equal to zero.
You have been contacted by Zing Zhu to calculate, given the height the tide will reach and the position and height of all fence strips, the total area of land which will not be flooded during the high tide. You may assume that the widths of fence strips are so thin compared to the size
of the land that, for the purpose of calculating the total area, fence strips may be considered as having widths equal to zero.
Input
The input contains several test cases. The first line of a test case contains an integer N indicating the number of fence strips in the island (1 <= N <= 2000). Each of the next N lines contains five integers X1, Y1,X2, Y2 and H, representing respectively the start point of the strip (X1, Y1), the end point of the strip (X2, Y2) and the strip height (H). The last line of a test case contains an integer W representing the tide height. Coordinates are given in meters, heights in centimeters. Furthermore, X1 = X2 or Y1 = Y2 (but not both); -500 <= X1, Y1,X2, Y2 <= 500; and 1 <= W,H <= 1000. The end of input is indicated by N = 0.
Output
For each test case in the input your program must produce one line of output, containing one integer representing the total area (in m2) of the land which will not be flooded.
Sample Input
4-20 20 20 20 20020 20 20 -20 2000 0 0 20 100-10 0 20 0 2001004-20 20 20 20 20020 20 20 -20 2000 0 0 20 100-10 0 20 0 2001010
Sample Output
4000
题目大意:给你一些栅栏,然后给你每个栅栏的高度,栅栏能构成空间,然后外面有水,水的高度给你,低于水的高度将会不安全,询问你最后能保持安全的面积为多少。
解题思路:我们可以通过扫描线从下往上搜索,然后只搜索高度高于水高度的栅栏,因为低于水高度的栅栏都会被水淹没,然后我们扫描求得安全面积。
阅读全文
1 0
- poj2091-Zing Zhu's Oyster Farm
- POJ 2091 Zing Zhu's Oyster Farm 笔记
- 从off-heap到Azul's Zing(JVM)
- zhu
- HDU5803 Zhu’s Math Problem (数位DP)
- Zing 源码
- 全功能zing
- HDU 5803 Zhu's Math Problem(数位DP)
- clolumn1: creacking the oyster
- Azul开源Zing Jvm
- hdu 5803 Zhu’s Math Problem (2016多校第六场1011)数位dp
- 2016多校训练Contest6: 1011 Zhu’s Math Problem hdu5803
- Hdu 5803 Zhu’s Math Problem(非记忆化数位dp)
- Zhu Ming
- ANDROID zhu
- column_1 Cracking the Oyster 习题解答
- Discussion with State Farm's Eric Webster: Insurance and Data Mining
- Zhu and 772002
- jQuery插件开发的模式和结构
- python-docx文件定位读取(尝试替换)
- G
- 1017. A除以B (20)
- linux命令发送http的get或post请求(curl和wget两种方法)
- poj2091-Zing Zhu's Oyster Farm
- 我的第一篇博文
- NSURLSession断点续传
- 关于 Spring Bean 生命周期
- 实习点滴(7)--《Investigating LSTM for Punctuation Prediction》论文笔记
- 2017 杭电多校联赛 1002 Balala Power!(数字替换字母)HDU 6034
- HDU1163 Eddy's digital Roots
- C++中不能被重载的运算符
- 资料.地址