设为首页 加入收藏

TOP

UVA 1331 Minimax Triangulation 区间DP(一)
2015-07-20 17:17:26 来源: 作者: 【 】 浏览:9
Tags:UVA 1331 Minimax Triangulation 区间


区间DP: 将一个多边形三角剖分,让可以得到的最大三角形的面积最小


dp[i][j]表示从i点到j点的最优值,枚举中间点k

dp[i][j]=min(dp[i][j],max(area(i,j,k),max(dp[i][k],dp[k][j])));

注意如果中间三角形i-j-k中有其他的点,这样的三角形是不可以剖分的


Minimax Triangulation
Time Limit: 3000MS Memory Limit: Unknown 64bit IO Format: %lld & %llu

Submit Status

Description

Download as PDF

Triangulation of surfaces has applications in the Finite Element Method of solid mechanics. The objective is to estimate the stress and strain on complex objects by partitioning them into small simple objects which are considered incompressible. It is convenient to approximate a plane surface with a simple polygon, i.e., a piecewise-linear, closed curve in the plane on m distinct vertices, which does not intersect itself. A chord is a line segment between two non-adjacent vertices of the polygon which lies entirely inside the polygon, so in particular, the endpoints of the chord are the only points of the chord that touch the boundary of the polygon. A triangulation of the polygon, is any choice of m -3 chords, such that the polygon is divided into triangles. In a triangulation, no two of the chosen chords intersect each other, except at endpoints, and all of the remaining (unchosen) chords cross at least one of the chosen chords. Fortunately, finding an arbitrary triangulation is a fairly easy task, but what if you were asked to find the best triangulation according to some measure?

\

Input

On the first line of the input is a single pZ??http://www.2cto.com/kf/ware/vc/" target="_blank" class="keylink">vc2l0aXZlIGludGVnZXIgbiwgdGVsbGluZyB0aGUgbnVtYmVyIG9mIHRlc3Qgc2NlbmFyaW9zIHRvIGZvbGxvdy4gRWFjaCBzY2VuYXJpbyBiZWdpbnMgd2l0aCBhIGxpbmUgY29udGFpbmluZyBvbmUgcG9zaXRpdmUgaW50ZWdlciAyIDwgbSA8IDUwLCBiZWluZyB0aGUgbnVtYmVyIG9mCiB2ZXJ0aWNlcyBvZiB0aGUgc2ltcGxlIHBvbHlnb24uIFRoZSBmb2xsb3dpbmcgbSBsaW5lcyBjb250YWluIHRoZSB2ZXJ0aWNlcyBvZiB0aGUgcG9seWdvbiBpbiB0aGUgb3JkZXIgdGhleSBhcHBlYXIgYWxvbmcgdGhlIGJvcmRlciwgZ29pbmcgZWl0aGVyIGNsb2Nrd2lzZSBvciBjb3VudGVyIGNsb2Nrd2lzZSwgc3RhcnRpbmcgYXQgYW4gYXJiaXRyYXJ5IHZlcnRleC4gRWFjaCB2ZXJ0ZXggaXMgZGVzY3JpYmVkIGJ5IGEgcGFpciBvZiBpbnRlZ2VycwogeCB5IG9iZXlpbmcgMCCh3CB4IKHcIDEwIDAwMCBhbmQgMCCh3CB5IKHcIDEwIDAwMC48L3A+CjxwPjwvcD4KPGgyPk91dHB1dCA8L2gyPgo8cD5Gb3IgZWFjaCBzY2VuYXJpbywgb3V0cHV0IG9uZSBsaW5lIGNvbnRhaW5pbmcgdGhlIGFyZWEgb2YgdGhlIGxhcmdlc3QgdHJpYW5nbGUgaW4gdGhlIHRyaWFuZ3UtbGF0aW9uIG9mIHRoZSBwb2x5Z29uIHdoaWNoIGhhcyB0aGUgc21hbGxlc3QgbGFyZ2VzdCB0cmlhbmdsZS4gVGhlIGFyZWEgc2hvdWxkIGJlIHByZXNlbnRlZCB3aXRoIG9uZSBmcmFjdGlvbmFsIGRlY2ltYWwKIGRpZ2l0LjwvcD4KPHA+PC9wPgo8aDI+U2FtcGxlIElucHV0IDwvaDI+CjxwcmUgY2xhc3M9"brush:java;">1 6 7 0 6 2 9 5 3 5 0 3 1 1

Sample Output

9.0

Source

Root :: AOAPC II: Beginning Algorithm Contests (Second Edition) (Rujia Liu) :: Chapter 9. Dynamic Programming :: Examples
Root :: AOAPC I: Beginning Algorithm Contests -- Training Guide (Rujia Liu) :: Chapter 1. Algorithm Design :: Dynamic Programming :: Exercises: Intermediate

Submit Status

\


/* ***********************************************
Author        :CKboss
Created Time  :2015年02月12日 星期四 16时24分21秒
File Name     :UVA1331.cpp
************************************************ */

#include 
  
   
#include 
   
     #include 
    
      #include 
     
       #include 
      
        #include 
       
         #include 
        
          #include 
         
           #include 
          
            #include 
           
             #include 
             using namespace std; const int maxn=60; const double INF = 1LL<<30; const double eps = 1e-7; struct Point { double x,y; Point(double _x=0,double _y=0):x(_x),y(_y){}; }pt[maxn]; double Area(int a,int b,int c) { Point A=pt[a],B=pt[b],C=pt[c]; return fabs((B.x-A.x)*(C.y-A.y)-(C.x-A.x)*(B.y-A.y))*0.5; } int n; double dp[maxn][maxn]; double dfs(int l,int r) { if(r==l+1) return dp[l][r]=0; if(dp[l][r]>eps) return dp[l][r
首页 上一页 1 2 下一页 尾页 1/2/2
】【打印繁体】【投稿】【收藏】 【推荐】【举报】【评论】 【关闭】 【返回顶部
分享到: 
上一篇CodeForces 171F(千古神题。。) 下一篇HDU 1253 胜利大逃亡

评论

帐  号: 密码: (新用户注册)
验 证 码:
表  情:
内  容:

·Redis on AWS:Elast (2025-12-27 04:19:30)
·在 Spring Boot 项目 (2025-12-27 04:19:27)
·使用华为开发者空间 (2025-12-27 04:19:24)
·Getting Started wit (2025-12-27 03:49:24)
·Ubuntu 上最好用的中 (2025-12-27 03:49:20)