poj 1092 Farmland
来源:互联网 发布:创意摆件 知乎 编辑:程序博客网 时间:2024/05/21 09:55
Description
There are two types of edges, boundary edge and non-boundary edge.All edges of G(V,E) except (v8, v6) and (v11, v10) are boundaryedges which are between two neighboring farming regions. The"proper farming region" in a Farmland graph is a closed regionbounded by a simple cycle and it should not contain any vertices oredges inside. In this figure, the polygon < v1,v9,v8,v7 >is aproper farming region, and the region < v2, v1, v7, v8 , v2, v5,v4, v3 >is not a proper farming region since its boundary cycleis not simple.
We assume that the farmland graph G(V,E) is a simple connectedgraph, which does not allow self-loops (Figure-2 (a)) and paralleledges (Figure-2 (b)).Also in Farmland graph G(V,E), we do notconsider the outer face of G(V,E).You can see that there are 2proper farming regions in G(V,E) shown in Figure-1,namely <v1,v9,v8,v7> and < v2,v3,v4,v5>, since there are novertices or edges inside. But the polygon< v1,v7,v8,v2> isnot a proper farming region since vertex v3, v4, and v5 are locatedin that region. Similarly, the region
There are other assumptions for input farmland graphdata.
1. There is at least one proper farmingregion.
2. The position of each vertex in Farmland graph isdistinct.
3. There is no edge crossing, which means the graph G(V,E) is aplane graph.
4. Farmland graph G(V,E) is simple andconnected.
Let us define the "size" of proper farming region. The size ofproper farming region is the number of boundary edges of thatregion. For example, the size of the proper farming region <v2,v3,v4,v5 > is 4.
The problem is to find the number of proper regions that have aspecified size.If you are requested to find the number of properregions with size of 4 in the graph given in Figure-1, you mustanswer that there are 2 proper regions whose sizes are 4 becausefarming regions < v1,v9,v8,v7 > and < v2,v3,v4,v5 >areproper regions and their sizes are 4. If there are no such regions,then you have to print 0.
Input
"i" is the vertex number, xi and yi are the coordinate (xi, yi) ofthe vertex i, and di is the degree of the vertex i. The following {ai } are the adjacent vertices of the vertex i. The last line givesk, the size of proper regions that you have tocount.
Note that M, the number of cases in input is less than 10. N, thenumber of vertices of a given farmland graph is less than 200. Allvertices are located on grid points of the 1000 x 1000 latticegrid.
Output
Sample Input
2
12
1 2 6 3 9 7 2
2 5 6 4 5 3 1 8
3 3 5 2 4 2
4 3 4 2 3 5
5 4 4 2 4 2
6 7 4 1 8
7 2 3 2 8 1
8 5 3 5 7 2 9 12 6
9 1 2 3 11 8 1
10 3 2 1 11
11 2 1 3 10 9 12
12 6 1 2 8 11
4
3
1 2 2 2 2 3
2 1 1 2 1 3
3 4 1 2 1 2
4
Sample Output
2
0
Source
#include
#include
#include
#define eps 1e-7
using namespace std;
bool tmp = 1;
struct Dot
{
} d[200];
int con[200][15];
bool vis_e[200][15];
bool vis_d[200];
bool insi[200];
int n, len, start;
bool graph[200][200];
bool anti;
//con是邻接表存边
//vis_e和vis_d记录删掉了哪些边和点
//graph是邻接矩阵储存的边,方便特判所有方向边是否都被删掉
//anti记录方向边是否都被删掉
//len即题目中的k,n是点数,start记录起始点
double cross (Dot g, Doth)
{
}
double mul (Dot g, Doth)
{
}
bool right (Dot g, Dot h, Dots)
{
}
bool dfs (int u, int g, inttmp)
{
//判断多边形内是否有点
}
int main()
{
//边删掉了就永远都不会再用了
//点要每次删除,因为一个点可能出现在多个简单多边形上
}
- poj 1092 Farmland
- POJ 1092 Farmland 已被翻译
- poj 2488
- POJ 2485 Highways
- POJ 3299
- poj 1905
- POJ 2247 Humble Numbers
- POJ 1753 Flip Game
- POJ 1182 食物链
- POJ 3185 The Water Bowls
- POj 2379 ACM Rank Table
- POJ 1018 Communication System
- POJ 1050 To the Max
- POj 1159 Palindrome (dp)
- POJ 3625 Building Roads
- POJ 2945 Find the Clones
- POJ 2413 How many Fibs?
- Distant Galaxy poj 3141
- bzoj 1070 [SCOI2007]修车
- 最后一更了。
- poj 2187 Beauty Contest
- 物理-刚体运动
- C++ 构造函数和运算符重载
- poj 1092 Farmland
- poj 1436 Horizontally&…
- C++ vector
- 简单多边形与圆的交面积
- 将博客搬至CSDN
- [编程语言][C语言]初识C语言
- 新博主SEO有互访了接下来应该做什么
- noi 2011 阿狸的打字机
- noi 2010 海拔