记录编号 39218 评测结果 AAAAAAAAAA
题目名称 校草 最终得分 100
用户昵称 Gravatarfuhao 是否通过 通过
代码语言 Pascal 运行时间 0.861 s
提交时间 2012-07-06 21:51:07 内存使用 2.55 MiB
显示代码纯文本
const maxn=100001;
var
 x:array[0..maxn,1..5] of longint;
 n,ans,i,j,pp:longint; min:array[0..maxn] of longint;
 away:array[0..maxn] of boolean;
 procedure change(var a,b:longint);
 var t:longint;
 begin
  t:=a; a:=b; b:=t;
 end;
 procedure kp1(l,r:longint);
 var i,j,mid:longint;
 begin
  i:=l; j:=r; mid:=x[(l+r) shr 1,1];
  repeat
   while x[i,1]<mid do inc(i);
   while x[j,1]>mid do dec(j);
   if i<=j then
    begin
     change(x[i,1],x[j,1]);
     change(x[i,2],x[j,2]);
     change(x[i,3],x[j,3]);
     change(x[i,4],x[j,4]);
     change(x[i,5],x[j,5]);
     inc(i); dec(j);
    end;
  until i>j;
  if i<r then kp1(i,r);
  if l<j then kp1(l,j);
 end;
 procedure kp2(l,r:longint);
 var i,j,mid:longint;
 begin
  i:=l; j:=r; mid:=x[(l+r) shr 1,2];
  repeat
   while x[i,2]<mid do inc(i);
   while x[j,2]>mid do dec(j);
   if i<=j then
    begin
     change(x[i,1],x[j,1]);
     change(x[i,2],x[j,2]);
     change(x[i,3],x[j,3]);
     change(x[i,4],x[j,4]);
     change(x[i,5],x[j,5]);
     inc(i); dec(j);
    end;
  until i>j;
  if i<r then kp2(i,r);
  if l<j then kp2(l,j);
 end;
 function lowbit(k:longint):longint;
 begin exit(k and (-k)); end;
 procedure insert(k,y:longint);
 begin
  while k<=n do
   begin
    if min[k]>y then min[k]:=y;
    k:=k+lowbit(k);
   end;
 end;
 function getmin(k:longint):longint;
 var t:longint;
 begin
  t:=maxlongint;
  while k>0 do
   begin
    if t>min[k] then t:=min[k];
    k:=k-lowbit(k);
   end;
  getmin:=t;
 end;
begin
 assign(input,'hjjhvf.in'); reset(input);
 assign(output,'hjjhvf.out'); rewrite(output);
 readln(n);
 for i:=1 to n do
  begin
   readln(x[i,1],x[i,2],x[i,3],x[i,4]);
   x[i,5]:=i;
  end;
 kp1(1,n);
 fillchar(min,sizeof(min),$7f div 2);
 for i:=1 to n do
 begin
  insert(x[i,2],x[i,3]);
  if getmin(x[i,2])<x[i,3] then
   away[x[i,5]]:=true;
 end;
 fillchar(min,sizeof(min),$7f div 2);
 for i:=1 to n do
 begin
  insert(x[i,2],x[i,4]);
  if getmin(x[i,2])<x[i,4] then
   away[x[i,5]]:=true;
 end;
 fillchar(min,sizeof(min),$7f div 2);
 for i:=1 to n do
 begin
  insert(x[i,3],x[i,4]);
  if getmin(x[i,3])<x[i,4] then
   away[x[i,5]]:=true;
 end;
 kp2(1,n);
 fillchar(min,sizeof(min),$7f div 2);
 for i:=1 to n do
 begin
  insert(x[i,3],x[i,4]);
  if getmin(x[i,3])<x[i,4] then
   away[x[i,5]]:=true;
 end;
 ans:=0;
 for i:=1 to n do
  if away[i] then inc(ans);
 writeln(ans);
 for i:=1 to n do
  if away[i] then writeln(i);
 close(input); close(output);
end.