ENG  RUSTimus Online Judge
Online Judge
Problems
Authors
Online contests
About Online Judge
Frequently asked questions
Site news
Webboard
Links
Problem set
Submit solution
Judge status
Guide
Register
Update your info
Authors ranklist
Current contest
Scheduled contests
Past contests
Rules
back to board

Discussion of Problem 1168. Radio Stations

why did I get WA?
Posted by The Answer 26 Jan 2002 13:19
const
        maxn=50;
type
        integer=longint;
var
        map,d,f:array[1..maxn,1..maxn] of integer;
        u:array[1..maxn,1..maxn] of boolean;
        p:array[1..maxn,1..2] of integer;
        r:array[1..maxn] of extended;
        n,m,k,tot:integer;
procedure init;
var     i,j:integer;
begin
        readln(n,m,k);
        for i:=1 to n do
                for j:=1 to m do read(map[i,j]);
        fillchar(u,sizeof(U),0);
        for i:=1 to k do begin
                read(p[i,1],p[i,2],r[i]);
                u[p[i,1],p[i,2]]:=true;
        end;
end;
procedure solve;
var     i,j,now,npos:integer;
        dis,h:extended;
begin
        for i:=1 to n do for j:=1 to m do d[i,j]:=maxlongint;
        fillchar(f,sizeof(f),0);
        for now:=1 to k do
                for i:=1 to n do
                        for j:=1 to m do if not u[i,j] then begin
                                dis:=sqrt(sqr(p[now,1]-i)+sqr(p
[now,2]-j));
                                if (dis>r[now])or(sqrt(sqr(dis)+sqr
(map[p[now,1],p[now,2]]-map[i,j]))>r[now])and(map[i,j]>=map[p
[now,1],p[now,2]]) then continue;
                                inc(f[i,j]);
                                h:=map[p[now,1],p[now,2]]+sqrt(sqr(r
[now])-sqr(dis));
                                npos:=trunc(h)-map[i,j]+1;
                                if npos<d[i,j] then d[i,j]:=npos;
                        end;
        tot:=0;
        for i:=1 to n do
                for j:=1 to m do if (not u[i,j])and(f[i,j]=k) then
inc(tot,d[i,j]);
        writeln(tot);
end;
begin
        init;
        solve;
end.
Re: why did I get WA?
Posted by gc007 30 Jun 2002 08:56
> how to draw circle?
  please think!