比赛 20120706 评测结果 WAAAAAAAAW
题目名称 校草 最终得分 80
用户昵称 fuhao 运行时间 0.000 s
代码语言 Pascal 内存使用 0.00 MiB
提交时间 2012-07-06 11:38:45
显示代码纯文本
const maxn=100001;
var
 away:array[0..maxn] of boolean;
 next:array[0..maxn] of longint;
 x:array[0..maxn,1..4] of longint;
 n,i,j:longint;
 function sn(k:longint):longint;
 begin
  if next[k]<>k then next[k]:=sn(next[k])
   else exit(k);
  sn:=next[k];
 end;
 function defeat(j,i:longint):boolean;
 begin
  if (x[i,1]>x[j,1]) and (x[i,2]>x[j,2]) and (x[i,3]>x[j,3]) then exit(true);
  if (x[i,1]>x[j,1]) and (x[i,2]>x[j,2]) and (x[i,4]>x[j,4]) then exit(true);
  if (x[i,1]>x[j,1]) and (x[i,3]>x[j,3]) and (x[i,4]>x[j,4]) then exit(true);
  if (x[i,2]>x[j,2]) and (x[i,3]>x[j,3]) and (x[i,4]>x[j,4]) then exit(true);
  exit(false);
 end;
begin
 assign(input,'hjjhvf.in'); reset(input);
 assign(output,'hjjhvf.out'); rewrite(output);
 readln(n);
 for i:=1 to n do readln(x[i,1],x[i,2],x[i,3],x[i,4]);
 for i:=1 to n+1 do next[i]:=i;
 i:=1;
 repeat
  next[i]:=sn(i);
  while away[i] do i:=next[i];
  repeat
   j:=j+1;
   next[j]:=sn(j);
   while away[j] do j:=next[j];
   if j<=n then
   if defeat(i,j) then
    begin
     away[j]:=true;
     next[j]:=next[j+1];
    end else
   if defeat(j,i) then
    begin
     away[i]:=true;
     i:=next[i+1];
    end;
  until j>n;
  inc(i);
 until i>n;
 j:=0;
 for i:=1 to n do
  if away[i] then inc(j);
 writeln(j);
 for i:=1 to n do
  if away[i] then writeln(i);
 close(input); close(output);
end.