- 飞翔
- 2017-05-26 22:19:42 @
是不是我太蒟蒻了?求大佬帮改
var
n,m,i,j,k,q,t,ans:longint;
a1,a2,f:array[0..1001] of longint;
function max(x,y:longint):longint;
begin
if x>y then exit(x) else exit(y);
end;
begin
ans:=-1;
read(n,m,q);
for i:=1 to q do
begin read(a1[i],a2[i]); f[i]:=1; end;
for i:=1 to q do
for j:=1 to i-1 do
if (a1[i]<a1[j])or(a1[i]=a2[j])and(a2[i]<a2[j]) then
begin
t:=a1[i]; a1[i]:=a1[j]; a1[j]:=t;
t:=a2[i]; a2[i]:=a2[j]; a2[j]:=t;
end;
//for i:=1 to q do write(a1[i],' ',a2[i],' ');writeln;
for i:=2 to q do
for j:=1 to i-1 do
begin
if (a1[j]<a1[i])and(a2[j]<a2[i]) then
f[i]:=max(f[i],f[j]+1);
ans:=max(ans,f[i]);
end;
//for i:=1 to q do write(f[i],' ');writeln;
writeln(round((n+m)*100-ans*(200-100*sqrt(2))));
end.