题目大意是给出n个人之间的交往记录,问某个人拥有的朋友数,朋友关系具有传递性。
很明显的并查集结构模型,两个人成为朋友即并查集中的合并操作,合并过程中顺便进行计数累加就是了。询问操作即输出其所属集合的计数即可。注意读入不要用字符串,由于读入数据很大字符串操作要进行很多次,耗时过大。
3014301 2008-07-30 17:53:01 Accepted 2833 FPC 00:00.54 1388K IwfWcf@LZOI
题目大意是给出n个人之间的交往记录,问某个人拥有的朋友数,朋友关系具有传递性。
很明显的并查集结构模型,两个人成为朋友即并查集中的合并操作,合并过程中顺便进行计数累加就是了。询问操作即输出其所属集合的计数即可。注意读入不要用字符串,由于读入数据很大字符串操作要进行很多次,耗时过大。
3014301 2008-07-30 17:53:01 Accepted 2833 FPC 00:00.54 1388K IwfWcf@LZOI
abercrombie and fitch, http://www.abercrombie-fitch.us.com/
回复删除cheap jordans, http://www.cheapjordanshoes.in.net/
cheap wedding dresses, http://www.cheap-weddingdresses.net/
oakley sunglasses, http://www.oakleysunglassescanada.com/
nike mercurial, http://www.nikemercurial.org/
michael kors outlet, http://www.michaelkorsoutletonlinstore.us.com/
ray ban sunglasses, http://www.raybansunglassesonline.us.com/
prada shoes, http://www.pradashoes.us/
moncler coats, http://www.moncler.us.com/
oakley sunglasses, http://www.wholesaleoakleysunglasses.us.com/
lacoste polo shirts, http://www.lacostepoloshirts.cc/
cheap oakley sunglasses, http://www.cheapoakleysunglassess.us.com/
adidas outlet store, http://www.adidasoutletstore.us.com/
north face outlet, http://www.thenorthface.me/
gucci, http://www.borseguccioutlet.it/
ugg outlet, http://www.uggsoutlet.us.org/
mulberry outlet, http://mulberryoutlet.outlet-store.co.uk/
ray ban sunglasses, http://www.rayban-sunglassess.us.com/
canada goose outlet, http://www.canadagoose.us.org/
futbol baratas, http://www.futbol-baratas.com/
kobe bryant shoes, http://www.kobebryantshoes.in.net/
cheap mlb jerseys, http://www.cheapmlbjerseys.net/
timberland boots, http://www.timberlandboots.name/
cheap nfl jerseys, http://www.cheapnfljerseys.org/
longchamp handbags, http://www.longchamphandbag.us.com/
michael kors outlet, http://www.michaelkorsoutletcanada.in.net/
montblanc pens, http://www.montblanc-pens.com.co/
coach outlet store, http://www.coach-outlet-store.us.com/
1003maoqiuyun
chi flat iron
回复删除ugg outlet
cheap uggs
holliste sale
timberland boots
hermes belt
coach outlet
nike roshe run
christian louboutin
cheap nike air max
20170112caiyan