状态: Unaccepted
测评机: Xeost[5]
得分: 90分
提交日期: 2010-8-14 0:33:00
有效耗时: 2141毫秒
测试结果1: 通过本测试点|有效耗时172ms
测试结果2: 通过本测试点|有效耗时47ms
测试结果3: 通过本测试点|有效耗时47ms
测试结果4: 通过本测试点|有效耗时47ms
测试结果5: 通过本测试点|有效耗时156ms
测试结果6: 通过本测试点|有效耗时172ms
测试结果7: 输出过少|用户输出数据少于标准输出的50%[标准输出14位|选手输出6位]
测试结果8: 通过本测试点|有效耗时203ms
测试结果9: 通过本测试点|有效耗时485ms
测试结果10: 通过本测试点|有效耗时812ms
提交代码:
var
i,j,k,n,m:longint;
a:array[-1..1000,-1..1000]of longint;
function max(x,y:longint):longint;
begin
if x>y then exit(x) else exit(y);
end;
begin
readln(n,m);
for i:=1 to n do
for j:=1 to m do
read(a[i,j]);
for i:=1 to n do
for j:=1 to m do
if (i*j<>1)and((a[i-1,j-2]>0)or(a[i-2,j-1]>0))and(a[i,j]<>-1) then
a[i,j]:=max(a[i-1,j-2],a[i-2,j-1])+a[i,j]
else
if i*j<>1 then a[i,j]:=-1;
for i:=1 to n do if a[i,m]>k then k:=a[i,m];
for i:=1 to m do if a[n,i]>k then k:=a[n,i];
if k=0 then write('cannot') else write(k);
end.