vj1126 &ccedil;Ÿ&copy;&aring;&frac12;&cent;&egrave;&brvbar;†&ccedil;›–

This preview shows pages 1–2. Sign up to view the full content.

//±ÉÈËµÄ·½·¨ //DP //³Ë»ý×î´óÄ£ÐÍ //¿ÉÒÔÃ¶¾Ùµã ÒÔÕâ¸öµãÎª»ù×¼ºáÏò»ò×ÝÏòÇÐ¿ªµÃÁ½¸öµã¼¯ s1 , s2 °Ñ s1 ÖÐµÄÓÃ 1 ¸ö¾ØÐÎ¸²¸Ç s2 ÖÐµÄµãÓÃ k-1 ¸ö¾ØÐÎ¸²¸Ç //¿ÉÒÔÏÈºáÏòÅÅÐò È»ºóºáÏò dp Ò»´Î ÔÙ×ÝÏòÅÅÐò ×ÝÏò dp Ò»´Î //f[i,j]=min( f[i,j] , f[k,j-1] + area(k+1,i) ) ÒòÎª¾ØÐÎ²»ÄÜÓÐ±ß»ò¶¥µãÖØºÏ ËùÒÔ x[k] or y[k] <> x[k+1] or y[k+1] x const maxk=4; maxn=50; var n,m:integer; g:array[0. .maxn,0. .1] of integer; f:array[0. .maxn,0. .maxk] of longint; low,high:array[0. .maxn,0. .maxn] of integer; procedure swap(var x,y:integer); var t:integer; begin t:=x; x:=y; y:=t; end; function min(x,y:longint):longint; begin if x<=y then exit(x) else exit(y); end; function max(x,y:longint):longint; begin if x>=y then exit(x) else exit(y); end; procedure init; var i:integer; begin readln(n,m);

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
This is the end of the preview. Sign up to access the rest of the document.