Description
There is a club whose members live in the towns. In each town, there is only one member or there are no members at all. The members want to meet in one of the regions (outside of any town). The members travel riding their bicycles. They do not want to enter any towns, because of the traffic, and they want to cross as few great walls as possible, as it is a lot of trouble. To go to the meeting region, each member needs to cross a number (possibly 0) of great walls. They want to find such an optimal region that the sum of these numbers (crossing-sum, for short) is minimized.

The towns are labeled with integers from 1 to N, where N is the number of towns. In Figure 1, the labeled nodes represent the towns and the lines connecting the nodes represent the great walls. Suppose that there are three members, who live in towns 3, 6, and 9. Then, an optimal meeting region and respective routes for members are shown in Figure 2. The crossing-sum is 2: the member from town 9 has to cross the great wall between towns 2 and 4, and the member from town 6 has to cross the great wall between towns 4 and 7.
You are to write a program which, given the towns, the regions, and the club member home towns, computes the optimal region(s) and the minimal crossing-sum.
Input
After that the input contains 2M lines so that there is a pair of lines for each region: the first two of the 2M lines describe the first region, the following two the second and so on. Of the pair, the first line shows the number of towns I on the border of that region. The second line of the pair contains I integers: the labels of these I towns in some order in which they can be passed when making a trip clockwise along the border of the region, with the following exception. The last region is the "outside region" surrounding all towns and other regions, and for it the order of the labels corresponds to a trip in counterclockwise direction. The order of the regions gives an integer labeling to the regions: the first region has label 1, the second has label 2, and so on. Note that the input includes all regions formed by the towns and great walls, including the "outside region".
Output
Sample Input
10
10
3
3 6 9
3
1 2 3
3
1 3 7
4
2 4 7 3
3
4 6 7
3
4 8 6
3
6 8 7
3
4 5 8
4
7 8 10 9
3
5 10 8
7
7 9 10 5 4 2 1
Sample Output
2
题意: 每个城市用城墙围起来, 现在有perNum个人想聚在一起, 地点是在城市和城墙围起来的区域内,
解题思路: (一个下午AC的题目)
代码:
#include <cstdio>
#include <iostream>
#include <cstring>
using namespace std;
#define MAX 305
const int INF = (1<<29);
struct node1
{
}edges[MAX*MAX];
struct node2
{
}region[MAX];
int n, m;
int dist[MAX][MAX]; //计算最短路径(cross walls number);
int first[MAX*2];
int num;
int person[MAX], perNum; //人的信息
inline int min(int a,int b)
{
}
inline void addedges(int re,int v) //点的相邻区域
{
}
inline void addregion(int re,int v) //添加区域的边界
{
}
bool find(int u,int v,int re) //判断边是否在区域re上
{
}
bool judge(int re1,int re2) //判断区域re1,re2是否相邻
{
}
void read_graph() //创建图, 以区域为节点的图
{
}
void floyd() //求最短路(点对点)
{
}
int main()
{
//
}