Colorful Toy
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 262144/262144 K (Java/Others)Total Submission(s): 171 Accepted Submission(s): 65
Problem Description
A toy is made up of N vertices and M undirected edges in the 2D plane. As usual, you want to know how many ways there are to color the vertices of the toy. You have totally C colors. And of course, to make things fun, you think that if one color configuration can be rotated to get another, these two configurations should be considered the same. Rotation means 2D in-plane rotation and reflection is not considered as rotation.
For instance, consider coloring the following toy with 2 colors. The coordinates of the vertices are:
1. (0,0)
2. (1,0)
3. (0,1)
4. (-1,0)
5. (0,-1)
The toy has 6 edges: (1,2), (1,3), (2,3), (3,4), (4,5), (5,2).
As a 2D being, this toy has no symmetry. So there are 32 ways to color it. Had the first two edges been removed, there would be only 12 different ways.
You should output the answer modulo 10 9 + 7.

For instance, consider coloring the following toy with 2 colors. The coordinates of the vertices are:
1. (0,0)
2. (1,0)
3. (0,1)
4. (-1,0)
5. (0,-1)
The toy has 6 edges: (1,2), (1,3), (2,3), (3,4), (4,5), (5,2).
As a 2D being, this toy has no symmetry. So there are 32 ways to color it. Had the first two edges been removed, there would be only 12 different ways.
You should output the answer modulo 10 9 + 7.
Input
The first line contains an integer T (T ≤ 20) denoting the number of the test cases.
Each test case begins with three positive integers N (1 ≤ N ≤ 50), M (0 ≤ M ≤ N (N - 1)/2) and C(1 ≤ C ≤ 100).
Then follow N lines. Each line contains 2 integers in range [-10000,10000] describing a vertex.
Then follow M lines. Each line contains 2 integers in range [1,N] representing an edge. There are neither duplicate edges nor self-loops.
Each test case begins with three positive integers N (1 ≤ N ≤ 50), M (0 ≤ M ≤ N (N - 1)/2) and C(1 ≤ C ≤ 100).
Then follow N lines. Each line contains 2 integers in range [-10000,10000] describing a vertex.
Then follow M lines. Each line contains 2 integers in range [1,N] representing an edge. There are neither duplicate edges nor self-loops.
Output
For each test case, output one line containing the answer.
Sample Input
2 5 6 2 0 0 1 0 0 1 -1 0 0 -1 1 2 1 3 2 3 3 4 4 5 5 2 5 4 2 0 0 1 0 0 1 -1 0 0 -1 2 3 3 4 4 5 5 2
Sample Output
32 12
题意:RT
思路:找出置换群,然后polya计数
可以先将所有的点按极角排序,然后按顺序枚举旋转的角度,判断一下所有点是否重合以及边是否重合
如果都满足就可以找出置换中的循环数量,然后polya计数,可以参考算法竞赛入门经典训练指南144-146页
#include
#include
#include
#include
#include
#include
#include
using namespace std; const int MOD = (int)(1e9+7); const int MAXN = 55; const double eps = 1e-8; typedef __int64 ll; int cmp(double x){ if(fabs(x)
x-a.x,this->y-a.y); double Cos=cos(angle); double Sin=sin(angle); point an(a.x+Cos*c.x-Sin*c.y , a.y+Sin*c.x+Cos*c.y); return an; } }; point P[MAXN],center; int edge[MAXN][MAXN]; int next[MAXN]; int n; vector
q; bool cmp1(int a,int b) { if(cmp(P[a].jiao-P[b].jiao)==0) return P[a].dis(center)
=MOD)x-=MOD; return x; } int main() { int t; scanf("%d",&t); while(t--){ int m,c; scanf("%d%d%d",&n,&m,&c); memset(edge,0,sizeof(edge)); for(int i=1;i<=n;i++){ int x,y; scanf("%d%d",&x,&y); P[i].x=x; P[i].y=y; } for(int i=0;i