Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
Home Page
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Update your info
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
User ID:
Password:
  Register

为什么会RE……

Posted by sqybi at 2006-12-01 21:12:19 on Problem 1088
我自己测输什么都不会RE
附代码:
Program pku1088_sqybi;
Const
  x: Array[1..4]Of Longint = (-1, 0, 1, 0);
  y: Array[1..4]Of Longint = (0, 1, 0, -1);

Var
  d: Array[0..101, 0..101]Of Longint;
  a: Array[1..100, 1..100]Of Longint;
  i, j, r, c, max: Longint;

Procedure f(i, j: Longint);
Var
  k, ii, jj: Longint;
Begin
  If (i = 0) Or (j = 0) Or (i = r + 1) Or (j = c + 1) Then Begin
    d[i, j] := 0;
    Exit;
  End;
  d[i, j] := 1;
  For k:=1 To 4 Do Begin
    ii := i + x[k];
    jj := j + y[k];
    If a[ii, jj] >= a[i, j] Then Continue;
    If d[ii, jj] = -1 Then f(ii, jj);
    If d[i, j] < d[ii, jj] + 1 Then d[i, j] := d[ii, jj] + 1;
  End;
End;

Begin
  ReadLn(r, c);
  For i:=1 To r Do Begin
    For j:=1 To c Do Read(a[i, j]);
    ReadLn;
  End;
  FillChar(d, SizeOf(d), $FF);
  max := -1;
  For i:=1 To r Do
    For j:=1 To c Do Begin
      If d[i, j] = -1 Then f(i, j);
      If d[i, j] > max Then max := d[i, j];
    End;
  WriteLn(max);
End.

Followed by:

Post your reply here:
User ID:
Password:
Title:

Content:

Home Page   Go Back  To top


All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator