- 笨笨的导弹攻击
- 2014-08-15 23:59:23 @
这TM都过了
program p1571;
var a:array[0..10000] of longint;
f:array[0..10000,1..2] of longint; n,i,j,sum:longint; //
function max(a,b:longint):longint;
begin
if a>b then exit(a) else exit(b); end;
//
begin
read(n); for i:=1 to n do read(a[i]); for i:=1 to n do f[i,1]:=1; for i:=1 to n do begin for j:=1 to i-1 do if (a[i]>a[j]) and (f[j,2]<>0) then f[i,1]:=max(f[j,2]+1,f[i,1]); for j:=1 to i-1 do if (a[i]<a[j]) and (f[j,1]<>0) then f[i,2]:=max(f[j,1],f[i,2]); end; for i:=1 to n do for j:=1 to 2 do sum:=max(sum,(f[i,j]-1)*2+j); write(sum); end.
7 条评论
-
CHambist LV 10 @ 2014-08-31 15:48:37
1w的数据如果n^2的常数不大都可以过啊
-
2014-08-29 16:10:35@
上海红茶馆...Intel Xeon @ 2.27GHz * 16 Core, 8GB Memory
-
2014-08-29 10:34:00@
Orz
-
2014-08-20 22:30:10@
你别看着vijos快你就欺负她.
回到到了noi评测器就会欺负你. -
2014-08-16 21:32:05@
Orz
-
2014-08-16 19:24:56@
Orz
-
2014-08-16 10:37:30@
Orz
- 1