蓝桥杯历届试题:邮局选址优化问题.pdfVIP

  • 0
  • 0
  • 约1.67千字
  • 约 2页
  • 2026-02-06 发布于北京
  • 举报

蓝桥杯历届试题:邮局选址优化问题.pdf

PastExamQuestionsPostOffice

TimeLimit:1.0sMemoryLimit:256.0MB

问题描述

VillageChasnhouseholds.Duetoitsisolatedlocation,thevillagerscanonlycommunicatewith

theoutsideworldthroughletters.Tofacilitatethevillagersletter-sending,VillageCplanstobuildk

postoffices,sothateachhouseholdcangotothenearestpostofficetosendtheirletters.

Now,mpotentiallocationsforthepostofficesaregiven.Choosekoftheselocationssuchthatthe

sumofthedistancesfromeachhouseholdtotheirnearestpostofficeisminimized.Thedistance

betweentwopointsisdefinedasthestraight-linedistancebetweenthem.

输入格式

Thefirstlineofinputcontainsthreeintegersn,m,k,representingthenumberofhouseholds,the

numberofpotentialpostofficelocations,andthenumberofpostofficestobebuilt,respectively.

Thenextnlineseachcontaintwointegersx,y,representingthecoordinatesofeachhouseholdinsequence.

Thenextmlines,eachlinecontainstwointegersx,y,indicatingthecoordinatesofeachcandidatepost

office.

Intheinput,thecoordinatesofvillagersandvillagers,villagersandpostoffices,andpostoffices

andpostofficesmaybethesame,butyoushouldconsiderthemasdifferentvillagersorpostoffices.

输出格式

Outputoneline,containingkintegers,listingtheindicesoftheselectedcandidatepostofficesin

ascendingorder.(Candidatepostofficesarenumberedfrom1tomaccordingtotheinputorder)

样例输入

542

00

20

31

33

11

01

10

21

32

样例输出

24

DataScaleand

Constraints

For30%ofthedata,1=n,1=m,1=k;for60%ofthe

=10=10=5

data,1=m;for100%ofthedata,1=n,1=m,1=k.

=20=50=25=10

文档评论(0)

1亿VIP精品文档

相关文档