状态: Accepted
测评机: Xeond[6]
得分: 100分 [我要评价一下题目~]
提交日期: 2012-10-24 13:44:00
有效耗时: 1844毫秒
RQNOJ近期在线比赛列表
RQNOJ2012年十月月赛 时间:2012-10-27 18:30:00 [报名]
测试结果1: 通过本测试点|有效耗时188ms
测试结果2: 通过本测试点|有效耗时218ms
测试结果3: 通过本测试点|有效耗时188ms
测试结果4: 通过本测试点|有效耗时187ms
测试结果5: 通过本测试点|有效耗时172ms
测试结果6: 通过本测试点|有效耗时172ms
测试结果7: 通过本测试点|有效耗时172ms
测试结果8: 通过本测试点|有效耗时172ms
测试结果9: 通过本测试点|有效耗时187ms
测试结果10: 通过本测试点|有效耗时188ms
提交代码: view sourceprint?01.var n,m,k,i,j,heng1,shu1:longint;
02.
ans:double;
03.
a,b:array[1..1000] of longint;
04.
aa,bb:array[1..1000000] of longint;
05.
heng,shu:array[1..1000000] of boolean;
06.
f:array[0..1000,0..1000] of integer;
07.
08.function max(u,v,w:longint):longint;
09.begin
10.
if u<v then u:=v;
11.
if u<w then u:=w;
12.
max:=u;
13.end;
14.begin
15.fillchar(heng,sizeof(heng),false);
16.fillchar(shu,sizeof(shu),false);
17.readln(n,m);
18.readln(k);
19.for i:=1 to k do
20.begin
21.readln(a[i],b[i]);
22.heng[a[i]]:=true;
23.shu[b[i]]:=true;
24.end;
25.for i:=1 to n do
26.if heng[i] then
27.begin inc(heng1);aa[i]:=heng1;end;
28.for i:=1 to m do
29.if shu[i] then
30.begin inc(shu1);bb[i]:=shu1;end;
31.
fillchar(f,sizeof(f),0);
32.
for i:=1 to k do
33.
f[aa[a[i]],bb[b[i]]]:=1;
34.
for i:=1 to heng1 do
35.
for j:=1 to shu1 do
36.
f[i,j]:=max(f[i-1,j],f[i,j-1],f[i-1,j-1]+f[i,j]);
37.
ans:=(n+m-2*f[heng1,shu1])*100+sqrt(20000)*f[heng1,shu1];
38.
writeln(ans:0:0);
39.end.