F - SCUD Busters
Time Limit:1000MS Memory Limit:10000KB 64bit IO Format:%I64d & %I64u
Submit
Status
Practice
POJ 1264
Description
Some problems are difficult to solve but have a simplification that is easy to solve. Rather than deal with the difficulties of constructing a model of the Earth (a somewhat oblate spheroid), consider a pre-Columbian flat world that is a 500 kilometer x 500 kilometer square.
In the model used in this problem, the flat world consists of several warring kingdoms. Though warlike, the people of the world are strict isolationists; each kingdom is surrounded by a high (but thin) wall designed to both protect the kingdom and to isolate it. To avoid fights for power, each kingdom has its own electric power plant.
When the urge to fight becomes too great, the people of a kingdom often launch missiles at other kingdoms. Each SCUD missile (anitary leansing niversal estroyer) that lands within the walls of a kingdom destroys that kingdom's power plant (without loss of life).
Given coordinate locations of several kingdoms (by specifying the locations of houses and the location of the power plant in a kingdom) and missile landings you are to write a program that determines the total area of all kingdoms that are without power after an exchange of missile fire.
In the simple world of this problem kingdoms do not overlap. Furthermore, the walls surrounding each kingdom are considered to be of zero thickness. The wall surrounding a kingdom is the minimal-perimeter wall that completely surrounds all the houses and the power station that comprise a kingdom; the area of a kingdom is the area enclosed by the minimal-perimeter thin wall.
There is exactly one power station per kingdom.
There may be empty space between kingdoms.
Output
The output consists of a single number representing the total area of all kingdoms without electricity after all missile attacks have been processed. The number should be printed with (and correct to) two decimal places.
题意:给你N个王国,求下凸包,再求面积。给你一些炮弹,问炮弹炸掉的面积。(一个炮弹炸的话,整个王国都被炸了)。
思路:这题一看就是面积嘛,只不过需要判定点在哪个凸包里面才得取,而且每个凸包的面积只能取一次,因为炸掉的面积重新炸第二次就木有了。
不过与前几题练习不同的地方就是这里有很多个凸包,然后我一想,就把vector改成了二维的了……然后逗了……输入老是运行崩溃,妹妹滴!!!检查好久也看不出哪个错啊,而且已经把二维的长度给resize了还出错,改了一个多小时实在不行了,就看了眼奎神的代码……晕……就知道自己思想不够开放了。
干嘛跟vector过不去呢,把结构体开个数组不就解决了嘛!唉……自己还是太弱了,把结构体数组给忘了,哈哈……
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include