大牛,help me!!!

编译通过...

├ 测试数据 01:答案错误... ├ 标准行输出

 ├ 错误行输出

├ 测试数据 02:答案正确... 0ms

├ 测试数据 03:答案正确... 0ms

├ 测试数据 04:答案正确... 0ms

├ 测试数据 05:答案正确... 0ms

├ 测试数据 06:答案正确... 0ms

├ 测试数据 07:答案正确... 0ms

├ 测试数据 08:答案正确... 0ms

├ 测试数据 09:答案正确... 0ms

├ 测试数据 10:答案正确... 0ms

---|---|---|---|---|---|---|---|-

Unaccepted 有效得分:90 有效耗时:0ms

var

n,m,i,l,r,t,h,temp:longint;

f,g,x:array[0..300000]of longint;

procedure dp1(l,r,x:longint);

var mid:longint;

begin

if xx

then dp1(mid,r,x)

else dp1(l,mid,x);

end;

procedure dp2(l,r,x:longint);

var mid:longint;

begin

if x>g[h]

then

begin

inc(h);

g[h]:=x;

exit;

end;

if r-l=1

then begin g[r]:=x; exit; end;

mid:=(l+r+1)shr 1;

if g[mid]>x

then

dp2(l,mid,x)

else dp2(mid,r,x);

end;

begin

readln(n,m);

t:=0;

h:=0;

for i:=1 to n do

read(x[i]);

f[0]:=x[m];

for i:=m downto 1 do

if (x[i]f[0])

then

dp2(0,h,x[i]);

writeln(h+t+1);

end.

编译通过...

├ 测试数据 01:答案正确... 0ms

├ 测试数据 02:答案正确... 0ms

├ 测试数据 03:答案正确... 0ms

├ 测试数据 04:答案正确... 0ms

├ 测试数据 05:答案正确... 0ms

├ 测试数据 06:答案正确... 0ms

├ 测试数据 07:答案正确... 0ms

├ 测试数据 08:答案正确... 0ms

├ 测试数据 09:答案正确... 0ms

├ 测试数据 10:答案正确... 0ms

---|---|---|---|---|---|---|---|-

Accepted 有效得分:100 有效耗时:0ms

var

n,m,i,l,r,t,h,temp:longint;

f,g,x:array[0..300000]of longint;

procedure dp1(l,r,x:longint);

var mid:longint;

begin

if xx

then dp1(mid,r,x)

else dp1(l,mid,x);

end;

procedure dp2(l,r,x:longint);

var mid:longint;

begin

if x>g[h]

then

begin

inc(h);

g[h]:=x;

exit;

end;

if r-l=1

then begin g[r]:=x; exit; end;

mid:=(l+r+1)shr 1;

if g[mid]g[h]

then

begin

inc(h);

g[h]:=x;

exit;

end;

if r-l=1

then begin g[r]:=x; exit; end;

mid:=(l+r+1)shr 1;

if g[mid]

1 条评论

  • 1

信息

ID
1369
难度
7
分类
动态规划 | LIS 点击显示
标签
递交数
3228
已通过
539
通过率
17%
被复制
3
上传者