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

Common Board

Help!!!! What's wrong?!??!?!!!!! (+)
Posted by Miguel Angel 3 Feb 2002 06:29
I wrote my program in Pascal cause in C++ it makes me Compilation
Error, I think is right but i get WA :(

type
point = record
          i, j: integer;
        end;
var
p: array[1..1000] of point;
s: array[1..1000] of real;
a: array[1..50,1..50] of longint;
used: array[1..50,1..50] of boolean;
ans, M, N, K: integer;

function dis(x,y:point): real;
var
   ii,jj,hh:real;
begin
    ii := (x.i-y.i)*(x.i-y.i);
    jj := (x.j-y.j)*(x.j-y.j);
    hh := (a[x.i,x.j]-a[y.i,y.j])*(a[x.i,x.j]-a[y.i,y.j]);
    dis:=sqrt(ii+jj+hh);
end;

var
   where:point;
   i, j, l:integer;
   label bad;
begin
      readln(M,N,K);
    for i:=1 to M do
      for j:=1 to N do used[i,j]:=false;
    for i:=1 to M do begin
      for j:=1 to N do read(a[i,j]);
          readln;
        end;
    for l:=1 to K do
        readln(p[l].i,p[l].j,s[l]);
    for l:=1 to K do
        used[p[l].i,p[l].j]:=true;
      ans:=0;
    for i:=1 to M do
       for j:=1 to N do
          if not used[i,j] then begin
             where.i:=i; where.j:=j;
         while a[i,j]<=32000 do begin
                for l:=1 to K do
                if dis(where,p[l])>s[l] then goto bad;
                     inc(a[i,j]);
             inc(ans);
         end;
         bad:
          end;
      write(ans);
end.