Compression-Project/problems/D.out
2020-05-30 23:37:44 +00:00

1 line
2 KiB
Text

summer is closing in,you have set your eyes on a summer internship with your fvrt fruit cnfdrcy,ctrs.what you really want is to take over ntr rgnstn on your way to world fruit dmntn,but gttng an internship is a nice first step.you know that there is a sngl prsn in ctrs dcdng who gets ntrnshp,but nfrtntly,you dont know who that prsn is.thus,you dcd to nfltrt ntr rgnztn by brbng some sbst of members,so that you are grntd to get internship.you have already gathred organization map,as well as stmtd mnt of money each member would rqr to aid your cnddcy.only thing remaining is deciding who to recruit.when you bribe a ctrs member,that member will be able to mnplt both their sprr as well as their drct sbrdnts to spprt your cnddcy.in this way it is not ncssry to bribe vryn in ctrs,as long as vryn in rgnstn is thr brbd or mnpltd by smn who is.in ddtn,you want to take an extra prctn.you do not want two dffrnt ppl to both be bribed if they ever talk to each other,then they might rlz what your final plan is,start blckmlng you.ctrs prtcl dctts that nbdy shld ever dscss nythng with nyn who is not their mmdt boss or sbrdnt,so you fgr your schm will be sffcntly safe as long as you avoid brbng mmdt sprr of smn else you bribe.to ntt nfltrtn you are to write a prgrm that given organizational map of ctrs as well as cost of rcrtng each of its members,tpts mnmm mnt of money rqrd to cmplt task.bcs ctrs is so wll-rgnzd,every member has xctly one mmdt sprvsr,xcpt one,only most sour xcllnc,who has only sbrdnts.ipf first line cnssts of an ntgr 1<=n<=100000,number of members in ctrs.then fllws n lines,each dscrbng a member,bgnnng with member 0,ndng with member n1.line dscrbng member i bgns with two ntgrs 0<=c_<=1000000,0<=_<n,cost of rcrtng member i,number of mmdt sbrdnts of member i rspctvly.then fllws u_i numbers on same line,dntfctn numbers of sbrdnts.note that all dntfctn numbers are btwn 0,n1.opf mnmm cost of nfltrtng ntr rgnztn while dhrng to rstrctns above.bsrv that nswr might very well be lrgr than 2^32.spi 8 2 2 1 2 4 0 3 0 20 1 6 20 1 3 3 2 0 4 5 1 7 1 0 spo 15