|
|
вернуться в форумSombody help me please ,I get WA and I don't know why. Послано Pooya 6 фев 2003 02:22 const Max = 30001; var A : array[1..Max+1]of longint; D : array[1..Max+1]of longint; x ,y ,I ,J ,K ,N : longint; begin for I := 1 to Max do begin A[I] := Max+1; D[I] := 0; end; read(N); for I := 1 to N do begin read(x ,y); if A[x] > y then A[x] := y; end; for I := Max downto 1 do if A[I] <> Max+1 then begin D[I] := D[I+1]; if D[I] < (1 + D[A[I]+1]) then D[I] := 1 + D[A[I]+1]; end else D[I] := D[I+1]; write(D[1]); end. Sorry I realized my bug. There are two problems with name conference. Послано Pooya 8 фев 2003 20:52 > const > Max = 30001; > var > A : array[1..Max+1]of longint; > D : array[1..Max+1]of longint; > x ,y ,I ,J ,K ,N : longint; > > begin > for I := 1 to Max do > begin > A[I] := Max+1; > D[I] := 0; > end; > > read(N); > > for I := 1 to N do > begin > read(x ,y); > if A[x] > y then > A[x] := y; > end; > > for I := Max downto 1 do > if A[I] <> Max+1 then > begin > D[I] := D[I+1]; > if D[I] < (1 + D[A[I]+1]) then > D[I] := 1 + D[A[I]+1]; > end > else > D[I] := D[I+1]; > > write(D[1]); > end. > |
|
|