比赛 201001-line 评测结果 AWWWWWWWWW
题目名称 编码问题 最终得分 10
用户昵称 reamb 运行时间 0.000 s
代码语言 Pascal 内存使用 0.00 MiB
提交时间 2010-01-18 21:46:05
显示代码纯文本
program bianmawenti;
var
  q,n,m,i,j,t,s,k,w,jilu:longint;
  a,b:array[1..100] of longint;
  biaozhi:array[1..100]of boolean;
begin
  assign (input,'code.in');
  reset (input);
  assign (output,'code.out');
  rewrite (output);
  readln (n,m);
  for i:=1 to n do
  begin
    readln (s);
    if s=1 then
    begin
      for j:=1 to m do
        read (a[j]);
      readln;
      write ('0',' ');
      for j:=2 to m do
        for k:=1 to j-1 do
          if a[k]<a[j] then
            b[j]:=b[j]+1;
      for j:=2 to m do
        write (b[j],' ');
      writeln
    end
    else
    begin
      for j:=1 to m do
        biaozhi[j]:=true;
      for j:=1 to m do
       read(a[j]);
      for j:=m downto 1 do
      begin
        t:=0;
        q:=0;
        repeat
           q:=q+1;
          if biaozhi[q]=true then
            t:=t+1;
        until t=a[j]+1;
        biaozhi[q]:=false;
        b[j]:=q-1
      end;
      for j:=1 to m do
        write (b[j],' ');
      writeln
    end
  end;
  close (input);
  close (output)
end.