比赛 20121109 评测结果 RRRRRRRRRR
题目名称 三元数对 最终得分 0
用户昵称 luschegde 运行时间 0.001 s
代码语言 Pascal 内存使用 0.56 MiB
提交时间 2012-11-09 09:24:55
显示代码纯文本
var
z:array [-3..30010]of int64;
a:array [0..30010]of longint;
opt:array [0..30000]of longint;
n,m,i,max:longint;
 procedure mo;
 begin
   z[1]:=1;
   for i:=2 to m do
    z[i]:=z[i-1]+i;
   for i:=2 to m do
    z[i]:=z[i-1]+z[i];
     writeln(z[max-2]);
 end;

 procedure init;
 var n:longint;
 begin
   readln(m);
   for i:=1 to m do
    readln(a[i]);
 end;
  procedure main;
  var i,j:longint;
  begin
    opt[0]:=0;
    a[0]:=-$7f;
    for i:=1 to m do
     for j:=i-1 downto 0 do
      if (a[i]>=a[j]) and (opt[j]+1>=opt[i]) then
       opt[i]:=opt[j]+1;
      for i:=1 to m do
       if opt[i]>max then max:=opt[i];
  end;
 begin
{ assign(input,'three.in');
 reset(input);
 assign(output,'three.out');
 rewrite(output);}
   init;
   main;
   mo;
 {  close(input);
   close(output);}
 end.