记录编号 39215 评测结果 AAAAAAAAAA
题目名称 校草 最终得分 100
用户昵称 Gravatarczp 是否通过 通过
代码语言 Pascal 运行时间 0.770 s
提交时间 2012-07-06 21:31:44 内存使用 3.69 MiB
显示代码纯文本
var
 a,r:array [1..4,1..100000] of longint;
 ans:array[1..100000] of boolean;
 c:array[1..100000] of longint;
 i,j,m,n,sum:longint;
function  min(xx,yy:longint):longint;
begin if xx>yy then min:=yy else min:=xx; end;
procedure plus(i,date:longint);
var j:longint;
begin
 while i<=n do
  begin
   c[i]:=min(c[i],date);
   j:=(i) and (-i);
   inc(i,j);
  end;
end;
function get(i:longint):longint;
var j,o:longint;
begin
 o:=maxlongint;
 while i>0 do
  begin
   o:=min(c[i],o);
   j:=(i) and (-i);
   dec(i,j);
  end;
  get:=o;
end;
procedure maketrue(x,y,z:longint);
var i,j:longint;
begin
  fillchar(c,sizeof(c),$7f);
  for i:=1 to n do
   begin
    j:=get(r[y,a[x,i]]);
    if j<r[z,a[x,i]] then if not ans[a[x,i]] then
     begin ans[a[x,i]]:=true; inc(sum); end;
    plus(r[y,a[x,i]],r[z,a[x,i]]);
   end;
end;
begin
 assign(input,'hjjhvf.in');reset(input);
 assign(output,'hjjhvf.out');rewrite(output);
 readln(n);
 for i:=1 to n do
  begin
   readln(r[1,i],r[2,i],r[3,i],r[4,i]);
   a[1,r[1,i]]:=i;
   a[2,r[2,i]]:=i;
   a[3,r[3,i]]:=i;
   a[4,r[4,i]]:=i;
  end;
 maketrue(1,2,3);
 maketrue(1,2,4);
 maketrue(2,3,4);
 maketrue(1,3,4);
 writeln(sum);
 for i:=1 to n do if ans[i] then writeln(i);
 close(input);close(output);
end.