2016 Multi-University Training Contest 1 G. Rigid Frameworks
2016-08-31 18:55
344 查看
Rigid Frameworks
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others)Total Submission(s): 337 Accepted Submission(s): 273
[align=left]Problem Description[/align]
Erik Demaine is a Professor in Computer Science at the Massachusetts Institute of Technology. Demaine's research interests range throughout algorithms, from data structures for improving web searches to the geometry of understanding how proteins fold to the computational difficulty of playing games.
Maid xiaodao is learning theoretical computer science in her spare time, and recently she was fascinated by Professor Erik Demaine's Geometric Folding Algorithms - Linkages, Origami, Polyhedra. The following problem was inspired by this book.
Recall that a graph is a collection of vertices and edges connecting the vertices, and that two vertices connected by an edge are called adjacent. Graphs can be embedded in Euclidean space by associating each vertex with a point in the Euclidean space.
⋅ A flexible graph is an embedding of a graph where it is possible to move one or more vertices continuously so that the distance between at least two nonadjacent vertices is altered while the distances between each pair of adjacent vertices is kept constant.
⋅ A rigid graph is an embedding of a graph which is not flexible. Informally, a graph is rigid if by replacing the vertices with fully rotating hinges and the edges with rods that are unbending and inelastic, no parts of the graph can be moved independently from the rest of the graph.
const int N = 15, MOD = 1e9 + 7; int n, m, f , all[N * N], C ; inline int add(int x, int y) { return (((x + y) % MOD) + MOD) % MOD; } inline int mul(int x, int y) { return (((x * 1ll * y) % MOD) + MOD) % MOD; } inline void init() { all[0] = 1; for(int i = 1; i < 15 * 15; ++i) all[i] = mul(all[i - 1], 3); for(int i = 0; i < N; ++i) C[i][0] = 1; for(int i = 1; i < N; ++i) for(int j = 1; j < N; ++j) C[i][j] = add(C[i - 1][j - 1], C[i - 1][j]); for(int n = 1; n <= 10; ++n) for(int m = 0; m <= 10; ++m) { f [m] = all[n * m]; for(int lef = 0; lef < n; ++lef) for(int rig = 0; rig <= m; ++rig) { if(lef == n - 1 && rig == m) continue; f [m] = add(f [m], -mul(mul(mul(C[n - 1][lef], C[m][rig]), f[lef + 1][rig]), all[(n - lef - 1) * (m - rig)])); } } } int main() { init(); while(scanf("%d%d", &n, &m) == 2) printf("%d\n", f [m]); return 0; }
View Code
相关文章推荐
- 2016 Multi-University Training Contest 9
- hdu 5861Road(2016 Multi-University Training Contest 10——线段树+扫描线)
- hdu5756 2016 Multi-University Training Contest 3 Boss Bo 解题报告
- 2016 Multi-University Training Contest 4 1001 Another Meaning (DP)
- 2016 Multi-University Training Contest 5 1011 Two(DP)
- 2016 Multi-University Training Contest 1 1004 hdu 5726 二分+RMQ
- HDU 5733 tetrahedron (2016 Multi-University Training Contest 1 计算几何)
- 2016 Multi-University Training Contest 1----解题报告
- hdu 5733 tetrahedron(2016 Multi-University Training Contest 1——几何公式题)
- 2016 Multi-University Training Contest 1 1005 Necklace
- 2016 Multi-University Training Contest 1-1004---HDU 5726 GCD
- [转自官方]2016 Multi-University Training Contest 2 solutions BY zimpha
- HDU 5738 Eureka (from: 2016 Multi-University Training Contest 2)
- hdu 5734 (2016 Multi-University Training Contest 2)
- HDU 5735 Born Slippy ( from:2016 Multi-University Training Contest 2 )
- 【HDU5731 2016 Multi-University Training Contest 1I】【轮廓线DP+容斥】Solid Dominoes Tilings nm棋盘1x2多边形填充稳定方案
- RMQ+二分——GCD ( HDU 5726 ) ( 2016 Multi-University Training Contest 1 1004 )
- (HDU 5728)2016 Multi-University Training Contest 1 PowMod(数论)
- 2016 Multi-University Training Contest 3 hdu 5753 Permutation Bo【打表+递推】
- 2016 Multi-University Training Contest 3 1011【鸽巢原理】