• 「BZOJ1579」[Usaco2009 Feb] Revamping Trails 道路升级

    「BZOJ1579」[Usaco2009 Feb] Revamping Trails 道路升级

    Description每天,农夫John需要经过一些道路去检查牛棚N里面的牛.农场上有M(1<=M<=50,000)条双向泥土道路,编号为1..M.道路i连接牛棚P1_i和P2_i(1<=P1_i<=N;1<=P2_i<=N).John需要T_i(1<=T_i<=1,000,000)时间单位用道路i从P1_i走到P2_i或者从P2_i走到P1_i他想更新一些路经来减少每天花在路上的时间.具体地说,他想更新K(1<=K<=20)条路经,将它们所须时间减为0.帮助FJ选择哪些...

    02014年4月12日5,339,dijkstra
  • 「BZOJ1657」[Usaco2006 Mar] Mooo 奶牛的歌声

    「BZOJ1657」[Usaco2006 Mar] Mooo 奶牛的歌声

    DescriptionFarmerJohn'sN(1<=N<=50,000)cowsarestandinginaverystraightrowandmooing.Eachcowhasauniqueheighthintherange1..2,000,000,000nanometers(FJreallyisasticklerforprecision).Eachcowmoosatsomevolumevintherange1..10,000.This"moo"travelsacrosstherowofcowsinbothdirections(exceptfortheendcows,obviously).Curiously,itisheardonlybytheclosestcowineachdirectionwhoseheightisstrictlylargerth...

    02014年4月10日3,544单调栈
  • 「POJ2653」Pick – up sticks

    「POJ2653」Pick - up sticks

    DescriptionStanhasnsticksofvariouslength.Hethrowsthemoneatatimeonthefloorinarandomway.Afterfinishingthrowing,Stantriestofindthetopsticks,thatisthesestickssuchthatthereisnostickontopofthem.Stanhasnoticedthatthelastthrownstickisalwaysontopbuthewantstoknowallthesticksthatareontop.Stansticksarevery,verythinsuchthattheirthicknesscanbeneglected.InputInputconsistsofanumberofcases.Thedataforeach...

    02014年4月10日3,011几何
  • 「POJ1269」Intersecting Lines

    「POJ1269」Intersecting Lines

    DescriptionWeallknowthatapairofdistinctpointsonaplanedefinesalineandthatapairoflinesonaplanewillintersectinoneofthreeways:1)nointersectionbecausetheyareparallel,2)intersectinalinebecausetheyareontopofoneanother(i.e.theyarethesameline),3)intersectinapoint.Inthisproblemyouwilluseyouralgebraicknowledgetocreateaprogramthatdetermineshowandwheretwolinesintersect.Yourprogramwillrepeatedlyreadinfourpo...

    02014年4月10日2,833几何
  • 「POJ3304」Segments

    「POJ3304」Segments

    DescriptionGiven n segmentsinthetwodimensionalspace,writeaprogram,whichdeterminesifthereexistsalinesuchthatafterprojectingthesesegmentsonit,allprojectedsegmentshaveatleastonepointincommon.InputInputbeginswithanumber T showingthenumberoftestcasesandthen, T testcasesfollow.Eachtestcasebeginswithalinecontainingapositiveinteger n ≤100showingthenumberofsegments.Afterthat,n linescontai...

    02014年4月10日3,111几何
  • 「POJ2398」Toy Storage

    「POJ2398」Toy Storage

    DescriptionMomanddadhaveaproblem:theirchild,Reza,neverputshistoysawaywhenheisfinishedplayingwiththem.TheygaveRezaarectangularboxtoputhistoysin.Unfortunately,Rezaisrebelliousandobeyshisparentsbysimplythrowinghistoysintothebox.Allthetoysgetmixedup,anditisimpossibleforRezatofindhisfavoritetoysanymore.Reza'sparentscameupwiththefollowingidea.Theyputcardboardpartitionsintothebox.EvenifRezak...

    02014年4月10日3,731几何
  • 「POJ2318」TOYS

    「POJ2318」TOYS

    DescriptionCalculatethenumberoftoysthatlandineachbinofapartitionedtoybox.Momanddadhaveaproblem-theirchildJohnneverputshistoysawaywhenheisfinishedplayingwiththem.TheygaveJohnarectangularboxtoputhistoysin,butJohnisrebelliousandobeyshisparentsbysimplythrowinghistoysintothebox.Allthetoysgetmixedup,anditisimpossibleforJohntofindhisfavoritetoys. John'sparentscameupwiththefollowingidea.Th...

    02014年4月10日4,706几何
  • 「JoyOI1510」专家复仇

    「JoyOI1510」专家复仇

    背景Background外星人完成对S国的考察后,准备返回,可他们的飞碟已经没燃料了……S国的专家暗自窃喜……复仇的机会终于来了——他们打算敲诈外星人一大笔钱……描述DescriptionS国有n个燃料基地,保存有外星人所需的全部燃料,编号分别为1,2,3,…,n,对于每个燃料基地i,都有「((i-1) mod 10)+1」吨燃料。其中,编号<=5的燃料基地两两之间都有可双向通行的路;对于其余每个燃料基地i,与(i-1),(i-3)之间,也有可双向通行...

    02014年4月9日3,497floyd
  • NOIP2013货车运输

    NOIP2013货车运输

    题目描述DescriptionA国有n座城市,编号从1到n,城市之间有m条双向道路。每一条道路对车辆都有重量限制,简称限重。现在有q辆货车在运输货物,司机们想知道每辆车在不超过车辆限重的情况下,最多能运多重的货物。输入描述InputDescription第一行有两个用一个空格隔开的整数n,m,表示A国有n座城市和m条道路。接下来m行每行3个整数x、y、z,每两个整数之间用一个空格隔开,表示从x号城市到y号城市有一条限重为z的道路。注意:x...

    142014年4月9日30,059kruskal,spfa,树上倍增
  • 「BZOJ1677」[Usaco2005 Jan] Sumsets 求和

    「BZOJ1677」[Usaco2005 Jan] Sumsets 求和

    DescriptionFarmerJohncommandedhiscowstosearchfordifferentsetsofnumbersthatsumtoagivennumber.Thecowsuseonlynumbersthatareanintegerpowerof2.Herearethepossiblesetsofnumbersthatsumto7:1)1+1+1+1+1+1+12)1+1+1+1+1+23)1+1+1+2+24)1+1+1+45)1+2+2+26)1+2+4HelpFJcountallpossiblerepresentationsforagivenintegerN(1<=N<=1,000,000).给出一个N(1≤N≤10^6),使用一些2的若干次幂的数相加来求之.问有多少...

    02014年4月8日3,905递推与动规
  • 「BZOJ1455」罗马游戏

    「BZOJ1455」罗马游戏

    Description罗马皇帝很喜欢玩杀人游戏。他的军队里面有n个人,每个人都是一个独立的团。最近举行了一次平面几何测试,每个人都得到了一个分数。皇帝很喜欢平面几何,他对那些得分很低的人嗤之以鼻。他决定玩这样一个游戏。它可以发两种命令:1.Merger(i,j)。把i所在的团和j所在的团合并成一个团。如果i,j有一个人是死人,那么就忽略该命令。2.Kill(i)。把i所在的团里面得分最低的人杀死。如果i这个人已经死了,这条命令就忽略。...

    32014年4月8日5,461可并堆
  • 「BZOJ2243」[SDOI2011] 染色

    「BZOJ2243」[SDOI2011] 染色

    Description给定一棵有n个节点的无根树和m个操作,操作有2类:1、将节点a到节点b路径上所有点都染成颜色c;2、询问节点a到节点b路径上的颜色段数量(连续相同颜色被认为是同一段),如“112221”由3段组成:“11”、“222”和“1”。请你写一个程序依次完成这m个操作。 Input第一行包含2个整数n和m,分别表示节点数和操作数;第二行包含n个正整数表示n个节点的初始颜色下面 行每行包含两个整数x和y,表示x和y之间有一条无向...

    12014年4月8日9,509线段树,树链剖分
102 / 144 « 上一页 1 ...100 101 102 103 104 ...144 下一页 »