记录编号 16207 评测结果 AAA
题目名称 烦人的幻灯片 最终得分 100
用户昵称 Gravatarreamb 是否通过 通过
代码语言 Pascal 运行时间 0.001 s
提交时间 2010-04-22 14:43:32 内存使用 0.25 MiB
显示代码纯文本
program huandengpian;
uses sysutils;
var
  biaozhi:array[1..26] of boolean;
  q,x,y,xmin,xmax,ymin,ymax,jilu:array[1..26] of integer;
  i,t,n:integer;
  time:real;
procedure sousuo(k:integer);
var
  z:integer;
begin
  if now*86400-time>0.95 then
  begin
    if t=1 then
    begin
      for i:=1 to n do
      begin
        write (chr((ord('A')+i-1)),' ');
        writeln (jilu[i])
      end
    end
    else
      writeln ('None');
    close (input);
    close (output);
    halt
  end;
  for z:=1 to n do
  if (biaozhi[z]=true) and (x[z]>=xmin[k])
  and(x[z]<=xmax[k]) and (y[z]>=ymin[k])and(y[z]<=ymax[k]) then
  begin
    q[k]:=z;
    biaozhi[z]:=false;
    if k=n then
    begin
      t:=t+1;
      if t>1 then
      begin
        writeln ('None');
        close (input);
        close (output);
        halt
      end
      else
        for i:=1 to n do
          jilu[i]:=q[i];
    end
    else
      sousuo (k+1);
    biaozhi[z]:=true
  end
end;
begin
  assign (input,'slides.in');
  reset (input);
  assign (output,'slides.out');
  rewrite (output);
    time:=now*86400;
    readln (n);
    for i:=1 to n do
      readln (xmin[i],xmax[i],ymin[i],ymax[i]);
    for i:=1 to n do
      readln (x[i],y[i]);
    for i:=1 to n do
      biaozhi[i]:=true;
    sousuo(1);
    if t=1 then
    begin
      for i:=1 to n do
      begin
        write (chr((ord('A')+i-1)),' ');
        writeln (jilu[i])
      end
    end
    else
      writeln ('None');
  close (input);
  close (output)
end.