program ModifyArray;
const
n = 12;
var
arr: array[1..n] of integer;
i, maxEl, minEl: integer;
begin
writeln('Введіть ', n, ' елементів масиву:');
for i := 1 to n do
read(arr[i]);
maxEl := arr[1];
minEl := arr[1];
for i := 2 to n do
begin
if arr[i] > maxEl then
maxEl := arr[i];
if arr[i] < minEl then
minEl := arr[i];
end;
for i := 1 to n do
begin
if arr[i] < 0 then
begin
if i mod 2 = 0 then
arr[i] := maxEl
else
arr[i] := minEl;
end;
end;
writeln('Змінений масив:');
for i := 1 to n do
write(arr[i], ' ');
end.
cHJvZ3JhbSBNb2RpZnlBcnJheTsKCmNvbnN0CiAgbiA9IDEyOyAKdmFyCiAgYXJyOiBhcnJheVsxLi5uXSBvZiBpbnRlZ2VyOwogIGksIG1heEVsLCBtaW5FbDogaW50ZWdlcjsKCmJlZ2luCiAgd3JpdGVsbign0JLQstC10LTRltGC0YwgJywgbiwgJyDQtdC70LXQvNC10L3RgtGW0LIg0LzQsNGB0LjQstGDOicpOwogIGZvciBpIDo9IDEgdG8gbiBkbwogICAgcmVhZChhcnJbaV0pOwoKCiAgbWF4RWwgOj0gYXJyWzFdOwogIG1pbkVsIDo9IGFyclsxXTsKICBmb3IgaSA6PSAyIHRvIG4gZG8KICBiZWdpbgogICAgaWYgYXJyW2ldID4gbWF4RWwgdGhlbgogICAgICBtYXhFbCA6PSBhcnJbaV07CiAgICBpZiBhcnJbaV0gPCBtaW5FbCB0aGVuCiAgICAgIG1pbkVsIDo9IGFycltpXTsKICBlbmQ7CgogIGZvciBpIDo9IDEgdG8gbiBkbwogIGJlZ2luCiAgICBpZiBhcnJbaV0gPCAwIHRoZW4KICAgIGJlZ2luCiAgICAgIGlmIGkgbW9kIDIgPSAwIHRoZW4KICAgICAgICBhcnJbaV0gOj0gbWF4RWwgCiAgICAgIGVsc2UKICAgICAgICBhcnJbaV0gOj0gbWluRWw7IAogICAgZW5kOwogIGVuZDsKCiAgd3JpdGVsbign0JfQvNGW0L3QtdC90LjQuSDQvNCw0YHQuNCyOicpOwogIGZvciBpIDo9IDEgdG8gbiBkbwogICAgd3JpdGUoYXJyW2ldLCAnICcpOwplbmQuCg==