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 1097. Square Country 2

Help!What's wrong with my program?
Posted by Lin 9 Jul 2001 20:26
Type Arr                        = record
          X,Y                   : Integer;
          P                     : Byte;
          L                     : Integer;
     End;
Var N,L,M                       : Integer;
    Land                        : Array[1..100] of Arr;
    S1,S2                       : Array[1..200] of Integer;
    Total1,Total2               : Integer;

Procedure Init;
Var i,j : Integer;
Begin
  Readln(N,L);
  Readln(M);
  For i := 1 to M do
    Readln(Land[i].P,Land[i].L,Land[i].X,Land[i].Y);
End;

Procedure Main;
Var i,j,k : Integer;
    T     : Arr;
    T2    : Integer;
    Max   : Byte;
    Min   : Byte;
    Yes   : Boolean;
Begin
  Min := 255;
  For i := 1 to N-L do
    For j := 1 to N-L do
      Begin
        Max := 0;
        For k := 1 to M do
          If (i+L<=Land[k].X) or (i>=Land[k].X+Land[k].L) or
             (j+L<=Land[k].Y) or (j>=Land[k].Y+Land[k].L)
then Continue
             else If Land[K].P>Max then
               Begin
                 Max := Land[K].P;
                 If Max>Min then Break;
               End;
        If Max<Min then
          Begin
            Min := Max;
          End;
      End;
  If Min<=100 then Writeln(Min)
              else Writeln('IMPOSSIBLE');
End;

Begin
  Init;
  Main;
End.
Sorry. Can you tell me how to accepted P 1018. I can.
> Type Arr                        = record
>           X,Y                   : Integer;
>           P                     : Byte;
>           L                     : Integer;
>      End;
> Var N,L,M                       : Integer;
>     Land                        : Array[1..100] of Arr;
>     S1,S2                       : Array[1..200] of
Integer;
>     Total1,Total2               : Integer;
>
> Procedure Init;
> Var i,j : Integer;
> Begin
>   Readln(N,L);
>   Readln(M);
>   For i := 1 to M do
>     Readln(Land[i].P,Land[i].L,Land[i].X,Land[i].Y);
> End;
>
> Procedure Main;
> Var i,j,k : Integer;
>     T     : Arr;
>     T2    : Integer;
>     Max   : Byte;
>     Min   : Byte;
>     Yes   : Boolean;
> Begin
>   Min := 255;
>   For i := 1 to N-L do
>     For j := 1 to N-L do
>       Begin
>         Max := 0;
>         For k := 1 to M do
>           If (i+L<=Land[k].X) or (i>=Land[k].X+Land[k].L)
or
>              (j+L<=Land[k].Y) or (j>=Land[k].Y+Land[k].L)
> then Continue
>              else If Land[K].P>Max then
>                Begin
>                  Max := Land[K].P;
>                  If Max>Min then Break;
>                End;
>         If Max<Min then
>           Begin
>             Min := Max;
>           End;
>       End;
>   If Min<=100 then Writeln(Min)
>               else Writeln('IMPOSSIBLE');
> End;
>
> Begin
>   Init;
>   Main;
> End.
Why do you use my name?
Posted by Lin 19 Jul 2001 20:59
> > Type Arr                        = record
> >           X,Y                   : Integer;
> >           P                     : Byte;
> >           L                     : Integer;
> >      End;
> > Var N,L,M                       : Integer;
> >     Land                        : Array[1..100] of Arr;
> >     S1,S2                       : Array[1..200] of
> Integer;
> >     Total1,Total2               : Integer;
> >
> > Procedure Init;
> > Var i,j : Integer;
> > Begin
> >   Readln(N,L);
> >   Readln(M);
> >   For i := 1 to M do
> >     Readln(Land[i].P,Land[i].L,Land[i].X,Land[i].Y);
> > End;
> >
> > Procedure Main;
> > Var i,j,k : Integer;
> >     T     : Arr;
> >     T2    : Integer;
> >     Max   : Byte;
> >     Min   : Byte;
> >     Yes   : Boolean;
> > Begin
> >   Min := 255;
> >   For i := 1 to N-L do
> >     For j := 1 to N-L do
> >       Begin
> >         Max := 0;
> >         For k := 1 to M do
> >           If (i+L<=Land[k].X) or (i>=Land[k].X+Land
[k].L)
> or
> >              (j+L<=Land[k].Y) or (j>=Land[k].Y+Land
[k].L)
> > then Continue
> >              else If Land[K].P>Max then
> >                Begin
> >                  Max := Land[K].P;
> >                  If Max>Min then Break;
> >                End;
> >         If Max<Min then
> >           Begin
> >             Min := Max;
> >           End;
> >       End;
> >   If Min<=100 then Writeln(Min)
> >               else Writeln('IMPOSSIBLE');
> > End;
> >
> > Begin
> >   Init;
> >   Main;
> > End.