PS D:\React> npm i -g expo-cli npm WARN EBADENGINE Unsupported engine {
npm WARN EBADENGINE package: '[email protected]',
npm WARN deprecated [email protected]: See https://github.com/lydell/source-map-resolve#deprecated
npm WARN deprecated [email protected]: Please upgrade to version 7 or higher. Older versions may use Math.random() in certain circumstances, which is known to be problematic. See https://v8.dev/blog/math-random for details.
npm WARN deprecated [email protected]: https://github.com/lydell/resolve-url#deprecated
npm WARN deprecated [email protected]: The querystring API is considered Legacy. new code should use the URLSearchParams API instead.
npm WARN deprecated [email protected]: Please upgrade to version 7 or higher. Older versions may use Math.random() in certain circumstances, which is known to be problematic. See https://v8.dev/blog/math-random for details.
npm WARN deprecated [email protected]: Please upgrade to version 7 or higher. Older versions may use Math.random() in certain circumstances, which is known to be problematic. See https://v8.dev/blog/math-random for details.
npm WARN deprecated [email protected]: The `subscriptions-transport-ws` package is no longer maintained. We recommend you use `graphql-ws` instead. For help migrating Apollo software to `graphql-ws`, see https:
changed 1528 packages, and audited 1529 packages in 4m
118 packages are looking for funding
run `npm fund` for details
26 vulnerabilities (10 moderate, 16 high)
To address issues that do not require attention, run:
npm audit fix
To address all issues (including breaking changes), run:
npm audit fix --force
Run `npm audit` for details.
const
k = 100;
type
maze = array [1..k, 1..k] of integer;
var
l : maze;
n, m: integer;
i, j: integer;
c: char;
t: text;
w: integer;
x0, y0: integer;
x1, y1: integer;
procedure ways(a,b,r:integer);
begin
if (w = 0) or (r < w) then {нет смысла идти дальше, если текущий путь уже превосходит найденный}
if (l[a,b] <> -2) then
if (r < l[a,b]) or (l[a,b] = -1) then {нет смысла идти, если текущая клетка уже была достигнута за меньшее число шагов}
begin
l[a,b] := r;
if (a = x1) and (b = y1) then
w := r
else
begin
if a <> 1 then ways(a - 1, b, r + 1);
if b <> 1 then ways(a, b - 1, r + 1);
if a <> n then ways(a + 1, b, r + 1);
if b <> m then ways(a, b + 1, r + 1);
end
end;
end;
begin
assign(t, 'input.txt');
reset(t);
w := 0;
readln(t, n, m);
readln(t, x0, y0);
readln(t, x1, y1);
for i := 1 to n do
begin
for j := 1 to m do
begin
read(t, c);
case c of
'.' : l[i,j] := -1; {будем считать, что если клетка отмечена как -1, то путь к ней еще не найден}
'X' : l[i,j] := -2; {-2, если клетка непроходима}
end;
end;
readln(t)
end;
close(t);
if (l[x0,y0] <> -2) and (l[x1,y1] <> -2) then
begin
l[x0,y0] := 1; {просто трюк, чтобы пройти проверку на (r < l[x0,y0])}
ways(x0, y0, 0);
end
else
l[x1,y1] := -1;
writeln(l[x1,y1])
end.