比赛 20110725 评测结果 AAAATAAATT
题目名称 失落的猴子 最终得分 70
用户昵称 Yoghurt 运行时间 0.000 s
代码语言 Pascal 内存使用 0.00 MiB
提交时间 2011-07-25 08:58:18
显示代码纯文本
program lostmonkey;
const
        filename='lostmonkey';
        maxn=2000;
var
        n,m,q:longint;
        map:array[0..maxn,0..maxn] of longint;

procedure swap(var a,b:longint);
var
        temp:longint;
begin
        temp:=a; a:=b; b:=temp;
end;

procedure makeit(x1,y1,x2,y2,l:longint);
var
        i,j:longint;
begin
        for i:=x1 to x2 do
        for j:=y1 to y2 do
                map[i,j]:=l;
end;

procedure solve;
var
        i,j,x1,y1,x2,y2,l:longint;
begin
        readln(n,m,q);
        for i:=1 to n do
        for j:=1 to m do
                map[i,j]:=0;
        for i:=1 to q do
        begin
                readln(x1,y1,x2,y2,l);
                if x1>x2 then
                begin
                        swap(x1,x2);
                        swap(y1,y2);
                end;
                if (x1<=x2) and (y1<=y2) then
                        makeit(x1,y1,x2,y2,l)
                else
                        if (x1<=y2) and (y1>y2) then
                                makeit(x1,y2,x2,y1,l);
        end;
end;

procedure print;
var
        i,j:longint;
begin
        for i:=1 to n do
        begin
                for j:=1 to m do
                        write(map[i,j]);
                writeln;
        end;
end;

begin
        assign(input,filename+'.in'); reset(input);
        assign(output,filename+'.out'); rewrite(output);

        solve;
        print;

        close(input); close(output);
end.