program ReplaceNegativeElements;
const
N = 12;
var
arr: array[1..N] of integer;
i, maxElem, minElem: integer;
begin
writeln('Введіть ', N, ' елементів масиву:');
for i := 1 to N do
read(arr[i]);
maxElem := arr[1];
minElem := arr[1];
for i := 2 to N do
begin
if arr[i] > maxElem then
maxElem := arr[i];
if arr[i] < minElem then
minElem := arr[i];
end;
for i := 1 to N do
begin
if arr[i] < 0 then
begin
if i mod 2 = 0 then
arr[i] := maxElem
else
arr[i] := minElem;
end;
end;
writeln('Модифікований масив:');
for i := 1 to N do
write(arr[i], ' ');
writeln;
end.
cHJvZ3JhbSBSZXBsYWNlTmVnYXRpdmVFbGVtZW50czsKY29uc3QKICBOID0gMTI7CnZhcgogIGFycjogYXJyYXlbMS4uTl0gb2YgaW50ZWdlcjsKICBpLCBtYXhFbGVtLCBtaW5FbGVtOiBpbnRlZ2VyOwpiZWdpbgogIHdyaXRlbG4oJ9CS0LLQtdC00ZbRgtGMICcsIE4sICcg0LXQu9C10LzQtdC90YLRltCyINC80LDRgdC40LLRgzonKTsKICBmb3IgaSA6PSAxIHRvIE4gZG8KICAgIHJlYWQoYXJyW2ldKTsKIG1heEVsZW0gOj0gYXJyWzFdOwogIG1pbkVsZW0gOj0gYXJyWzFdOwogIGZvciBpIDo9IDIgdG8gTiBkbwogIGJlZ2luCiAgICBpZiBhcnJbaV0gPiBtYXhFbGVtIHRoZW4KICAgICAgbWF4RWxlbSA6PSBhcnJbaV07CiAgICBpZiBhcnJbaV0gPCBtaW5FbGVtIHRoZW4KICAgICAgbWluRWxlbSA6PSBhcnJbaV07CiAgZW5kOwogZm9yIGkgOj0gMSB0byBOIGRvCiAgYmVnaW4KICAgIGlmIGFycltpXSA8IDAgdGhlbgogICAgYmVnaW4KICAgICAgaWYgaSBtb2QgMiA9IDAgdGhlbgogICAgICAgIGFycltpXSA6PSBtYXhFbGVtCiAgICAgIGVsc2UKICAgICAgICBhcnJbaV0gOj0gbWluRWxlbTsKICAgIGVuZDsKICBlbmQ7CndyaXRlbG4oJ9Cc0L7QtNC40YTRltC60L7QstCw0L3QuNC5INC80LDRgdC40LI6Jyk7CiAgZm9yIGkgOj0gMSB0byBOIGRvCiAgICB3cml0ZShhcnJbaV0sICcgJyk7CiAgd3JpdGVsbjsKZW5kLg==