记录编号 39204 评测结果 ATTTTTTTTA
题目名称 校草 最终得分 20
用户昵称 GravatarSnowDancer 是否通过 未通过
代码语言 Pascal 运行时间 8.010 s
提交时间 2012-07-06 16:52:52 内存使用 3.03 MiB
显示代码纯文本
program hjjhvf;
var
  value:array[1..100001,1..4] of longint;
  out:array[1..100001] of longint;
  bo,bop:array[1..100001] of boolean;
  next,pre:array[1..100001] of longint;
  n,i,j,k,l,tot,count,f,m:longint;
function search(k:longint):longint;
  begin
    if not bo[k] then exit(k);
    next[k]:=search(next[k]);
    exit(next[k]);
  end;
procedure qsort(l,r:longint);
  var
    i,j:longint;
  begin
    i:=l;j:=r;m:=out[(i+j) div 2];
    repeat
      while out[i]<m do inc(i);
      while out[j]>m do dec(j);
      if i<=j then begin
        k:=out[i];out[i]:=out[j];out[j]:=k;
        inc(i);dec(j);
      end;
    until i>j;
    if l<j then qsort(l,j);
    if i<r then qsort(i,r);
  end;
begin
assign(input,'hjjhvf.in');reset(input);
assign(output,'hjjhvf.out');rewrite(output);
  readln(n);
  for i:=1 to n do
    for j:=1 to 4 do
      read(value[i,j]);
  for l:=1 to 4 do begin
    fillchar(bo,sizeof(bo),false);
    for i:=1 to n do begin
      next[i]:=i+1;
      pre[i]:=i-1;
    end;
    i:=1;
    while i<n do begin
      j:=search(i+1);
      while j<=n do begin
        count:=0;
        for k:=1 to 4 do
          if (l<>k) then
            if (value[i,k]>value[j,k]) then
              inc(count)
            else
              dec(count);
        if count=-3 then begin
          if not bo[j] then begin
            next[pre[j]]:=next[j];
            pre[next[j]]:=pre[j];
            bo[j]:=true;
          end;
          if not bop[j] then begin
            inc(tot); out[tot]:=j;
            bop[j]:=true;
          end;
        end;
        if count=3 then begin
          if not bop[i] then begin
            inc(tot); out[tot]:=i;
            bop[i]:=true;
          end;
          if not bo[i] then bo[i]:=true;
        end;
        j:=search(j+1);
      end;
      i:=search(i+1);
    end;
  end;
  qsort(1,tot);
  writeln(tot);
  for i:=1 to tot do writeln(out[i]);
close(input);close(output);
end.