- 过河
- 2009-07-11 16:30:48 @
我不知道什么压缩 什么排序
只是用了动规
var
i,j,p,q,l,s,x,t,m,v:integer;
a,f:array[-10..1000000000] of 0..1;
jl:array[1..100] of integer;
begin
fillchar(f,sizeof(f),0);
fillchar(a,sizeof(a),0);
readln(l);
readln(s,t,m);
for i:=1 to m do
begin
read(x);
a[x]:=1;
end;
for i:=s to t do
if a[i]=1 then f[i]:=f[i]+1;
v:=0;
while v
3 条评论
-
bjlfzs LV 5 @ 2016-10-05 15:41:11
爆空间啦
-
2009-08-06 17:58:45@
const maxl=4000; maxm=100;……
const
maxl=4000;
maxm=100;
var
l,i,j,ans:longint;
s,t,m:byte;
stone:array[0..maxm+1] of longint;
b:array[1..maxl] of byte;
f:array[-10..maxl] of longint;
procedure swap(var a,b:longint);
var c:longint;
begin
c:=a;a:=b;b:=c;
end;
function min(a,b:longint):longint;
begin
if astone[j]
then swap(stone[i],stone[j]);
stone[0]:=0;stone[m+1]:=l;
for i:=1 to m+1 do
if stone[i]-stone>90
then stone[i]:=stone+(stone[i]-stone) mod 90;
l:=stone[m+1];
fillchar(b,sizeof(b),0);
for i:=1 to m do
b[stone[i]]:=1;
for i:=-10 to 0 do
f[i]:=0;
for i:=1 to l+t do
f[i]:=maxint;
for i:=s to l+t do
for j:=s to t do
f[i]:=min(f[i],f+b[i]);
ans:=maxint;
for i:=l to l+t do
ans:=min(ans,f[i]);
writeln(ans);
end. -
2009-07-11 21:00:49@
路径压缩
有很多连续的0可以证明是没用的,自己想想怎么压吧。
- 1