type node=record x,y:longint; end; ; var k,q,qq:longint; sum:double; f,g:..maxn] of node; m,i,j,a,b:longint; stack:..maxn] of longint; nm:longint; function dis(a,b:node):double; begin exit(sqrt(sqr(a.x-b.x)+sqr(a.y-b.y))); end; procedure swap(var a,b…