记录编号 39187 评测结果 AAAAAAAAAA
题目名称 绘画 最终得分 100
用户昵称 Gravatarczp 是否通过 通过
代码语言 Pascal 运行时间 5.063 s
提交时间 2012-07-05 21:23:42 内存使用 11.20 MiB
显示代码纯文本
var
  map,fa:array[0..1022,0..1022] of longint;
  d,d1,d2,d3,d4,d5,save,next:array[1..100022] of longint;
  i,j,m,n,s,mn,k:longint;
  ch,ch1:char;
 procedure print(x,y:longint);
 begin
  if y>d4[i] then exit;
  if map[x,y]=1 then map[x,y]:=d5[i];
  print(x,fa[x,y]);
  if fa[x,y]<=d4[i] then fa[x,y]:=fa[x,fa[x,y]];
 end;
begin
 assign(input,'drawing.in');reset(input);
 assign(output,'drawing.out');rewrite(output);
 readln(n,k,m);
 s:=0;
 for i:=1 to m do
  begin
    next[i]:=next[i+1];
    ch:='0';
    repeat
     ch1:=ch;
     read(ch);
    until (ch=' ') or (ch='E');
    if ch1='T' THEN
     begin
      d[i]:=0;
      readln(d5[i],d1[i],d2[i],d3[i],d4[i]);
     end;
    if ch1='D' THEN
     begin
       d[i]:=1;
       readln(d1[i]);
     end;
    if ch='E' THEN
     begin
       inc(s);
       d[i]:=2;
       save[s]:=i;
       readln;
     end;
  end;
 for i:=0 to n-1 do
  for j:=0 to n-1 do
   begin
    fa[i,j]:=j+2;
    map[i,j]:=1;
   end;
i:=m;
while i>0 do
  begin
   if d[i]=0 then
    begin
     for j:=d1[i] to d3[i] do
      if (j-d1[i]) mod 2=0 then
      print(j,d2[i]) else print(j,d2[i]+1);
    end;
   if d[i]=1 then i:=save[d1[i]];
   dec(i);
  end;
 for i:=0 to n-1 do
  begin
   for j:=0 to n-1 do
     write(map[i,j],' ');
   writeln;
  end;
 close(input);close(output);
end.