|
|
вернуться в форум1119 Help! What's wrong with my program. I get wrong answer in test2. < Program 1119; Var amax,n,m,k,a,b,c,d:longint; shu:array[1..101]of record x,y:longint; end; an:array[1..101]of longint; Function Qiu(u:longint):longint; var r:longint; max:longint; begin max:=1; for r:=1 to k do begin if (shu[u].x+1<=shu[r].x)and(shu[u].y+1<=shu[r].y) then begin if an[r]=-1 then an[r]:=qiu(r); if an[r]+1>max then max:=an[r]+1; end; end; qiu:=max; end; Begin readln(n,m); readln(k); for k:=1 to k do begin readln(shu[k].x,shu[k].y); an[k]:=-1; end; for a:=1 to k do begin for b:=1 to k do begin if ((shu[a].x<shu[b].x)or(shu[a].y<shu[b].y)) or((shu[a].x=shu[b].x)and(shu[a].y<shu[b].y)) then begin c:=shu[a].x;d:=shu[a].y; shu[a].x:=shu[b].x;shu[a].y:=shu[b].y; shu[b].x:=c;shu[b].y:=d; end; end; end; for a:=1 to k do an[a]:=Qiu(a); amax:=0; for a:=1 to k do begin if an[a]>amax then amax:=an[a]; end; writeln((n+m-2*amax)*100+amax*100*sqrt(2):0:0); End. > |
|
|