Program Rome; type point = record x, y: integer; end; var arr: array of point; additionally: array of point; middle: point; n: integer; function calculateLength(point1, point2, middle: point): integer; begin calculateLength := abs(point1.x - middle.x) + abs(point1.y - point2.y) + abs(point2.x - middle.x); end; Begin n := 5; setLength(arr, n); arr[0].x := 1; arr[0].y := 2; arr[1].x := 2; arr[1].y := 1; arr[2].x := 3; arr[2].y := 5; arr[3].x := 4; arr[3].y := 4; arr[4].x := 6; arr[4].y := 2; //findMiddle return arr2 for var kek := 0 to n - 1 do begin middle := arr[kek]; for var i := 0 to n - 1 do begin for var j := 0 to n - 1 do begin if(i <> j) then begin //writeln(i + 1, ' - ', j + 1, ' = ', calculateLength(arr[i], arr[j], middle)); end; end; end; var max_y, min_y: integer; max_y := 0; min_y := 9999; for var i := 0 to n - 1 do begin if (max_y < arr[i].y) then begin max_y := arr[i].y; end; if (min_y > arr[i].y) then begin min_y := arr[i].y; end; end; var middle_length: integer; middle_length := abs(max_y - min_y); var length: integer; length := middle_length; for var i := 0 to (n - 1) do begin length += abs(arr[i].x - middle.x); end; writeln(length); end; var temp: integer; end.