• 「NOIP模拟赛」欢乐斗牛

    「NOIP模拟赛」欢乐斗牛

    题目时限2s,空间128M「题目背景」为了更快的获取欢乐豆(因为本蒟蒻斗地主水平太低233),hzwer准备去玩欢乐斗牛,但是由于rp太差,hzwer在一个小时之内输光了20个QQ号的欢乐豆(每天系统会赠送每个号4000欢乐豆)。第二天他准备继续再战欢乐斗牛的抢庄模式,但是由于缺乏思考能力,hzwer需要编写一个程序来决定是否抢庄。「题目描述」在玩家决定是否抢庄之前,系统会下发四张牌称为底牌,最后一张牌在决定后发放,每张牌可能为...

    02014年8月2日3,392模拟
  • 公路修建

    公路修建

    http://218.5.5.242:9018/JudgeOnline/problem.php?id=1443题目描述     某国有n个城市,它们互相之间没有公路相通,因此交通十分不便。为解决这一“行路难”的问题,政府决定修建公路。修建公路的任务由各城市共同完成。修建工程分若干轮完成。在每一轮中,每个城市选择一个与它最近的城市,申请修建通往该城市的公路。政府负责审批这些申请以决定是否同意修建。政府审批的规则如下:(1)如果两个或以上城市申请修建同一条...

    02014年8月2日3,774prim
  • 「BZOJ1674」[Usaco2005] Part Acquisition

    「BZOJ1674」[Usaco2005] Part Acquisition

    DescriptionThecowshavebeensentonamissionthroughspacetoacquireanewmilkingmachinefortheirbarn.TheyareflyingthroughaclusterofstarscontainingN(1<=N<=50,000)planets,eachwithatradingpost.ThecowshavedeterminedwhichofK(1<=K<=1,000)typesofobjects(numbered1..K)eachplanetintheclusterdesires,andwhichproductstheyhavetotrade.Noplanethasdevelopedcurrency,sotheyworkunderthebartersystem:alltr...

    02014年8月2日3,254dijkstra
  • 「CF453B」Little Pony and Harmony Chest

    「CF453B」Little Pony and Harmony Chest

    PrincessTwilightwenttoCelestiaandLuna'soldcastletoresearchthechestfromtheElementsofHarmony.Asequenceofpositiveintegers bi isharmonyifandonlyifforeverytwoelementsofthesequencetheirgreatestcommondivisorequals1.Accordingtoanancientbook,thekeyofthechestisaharmonysequence bi whichminimizesthefollowingexpression:Youaregivensequence ai,helpPrincessTwilighttofindthekey.InputThefirstlinec...

    02014年8月2日4,006递推与动规,状压动规
  • 「CF453A」Little Pony and Expected Maximum

    「CF453A」Little Pony and Expected Maximum

    TwilightSparklewasplayingLudowithherfriendsRainbowDash,AppleJackandFlutterShy.Butshekeptlosing.Havingreturnedtothecastle,TwilightSparklebecameinterestedinthedicethatwereusedinthegame.Thedicehas m faces:thefirstfaceofthedicecontainsadot,thesecondonecontainstwodots,andsoon,the m-thfacecontains m dots.TwilightSparkleissurethatwhenthediceistossed,eachfaceappearswithprobability .A...

    02014年8月2日3,683概率与期望
  • 「CF454B」Little Pony and Sort by Shift

    「CF454B」Little Pony and Sort by Shift

    Oneday,TwilightSparkleisinterestedinhowtosortasequenceofintegers a1, a2, ..., an innon-decreasingorder.Beingayoungunicorn,theonlyoperationshecanperformisaunitshift.Thatis,shecanmovethelastelementofthesequencetoitsbeginning:a1, a2, ..., an → an, a1, a2, ..., an - 1.HelpTwilightSparkletocalculate:whatistheminimumnumberofoperationsthatsheneedstosortthesequence?InputThefirst...

    02014年8月2日3,635模拟
  • 「CF454A」 Little Pony and Crystal Mine

    「CF454A」 Little Pony and Crystal Mine

    TwilightSparkleoncegotacrystalfromtheCrystalMine.Acrystalofsize n (n isodd; n > 1)isan n × n matrixwithadiamondinscribedintoit.Youaregivenanoddinteger n.Youneedtodrawacrystalofsize n.Thediamondcellsofthematrixshouldberepresentedbycharacter"D".Allothercellsofthematrixshouldberepresentedbycharacter"*".Lookattheexamplestounderstandwhatyouneedtodraw.InputTheonlylinecontain...

    02014年8月2日3,910模拟
  • 「BZOJ1861」[ZJOI2006] Book 书架

    「BZOJ1861」[ZJOI2006] Book 书架

    Description小T有一个很大的书柜。这个书柜的构造有些独特,即书柜里的书是从上至下堆放成一列。她用1到n的正整数给每本书都编了号。小T在看书的时候,每次取出一本书,看完后放回书柜然后再拿下一本。由于这些书太有吸引力了,所以她看完后常常会忘记原来是放在书柜的什么位置。不过小T的记忆力是非常好的,所以每次放书的时候至少能够将那本书放在拿出来时的位置附近,比如说她拿的时候这本书上面有X本书,那么放回去时这本...

    22014年8月1日5,826splay
  • 「BZOJ1864」[ZJOI2006] 三色二叉树

    「BZOJ1864」[ZJOI2006] 三色二叉树

    DescriptionInput仅有一行,不超过500000个字符,表示一个二叉树序列。Output输出文件也只有一行,包含两个数,依次表示最多和最少有多少个点能够被染成绿色。SampleInput1122002010SampleOutput52题解随便dp一下即可f[i][0/1]表示i结点为绿/非绿色的绿色结点的最大个数转移f[x][1]=f[l[x]][0]+f[r[x]][0]+1;f[x][0]=max(f[l[x]][0]+f[r[x]][1],f[r[x]][0]+f[l[x]][1]);最小值类似[crayon-67abb3ee11e6c657482669/] &n...

    12014年8月1日4,183树形动规
  • 「BZOJ3673」可持久化并查集 by zky

    「BZOJ3673」可持久化并查集 by zky

    Descriptionn个集合m个操作操作:1ab合并a,b所在集合2k回到第k次操作之后的状态(查询算作操作)3ab询问a,b是否属于同一集合,是则输出1否则输出00<n,m<=2*10^4SampleInput561123122031221312SampleOutput101题解这题不知道出题人什么做法,但是代码很短的样子UPD:出题人用的是rope,即stl中的可持久化平衡树KuribohG神犇告诉了我可以用可持久化线段树实现可持久化数组TT 既然都有可持久化数组了,只要用个再...

    162014年8月1日25,352可持久化线段树
  • 「POJ3321」Apple Tree

    「POJ3321」Apple Tree

    DescriptionThereisanappletreeoutsideofkaka'shouse.Everyautumn,alotofappleswillgrowinthetree.Kakalikesappleverymuch,sohehasbeencarefullynurturingthebigappletree.ThetreehasNforkswhichareconnectedbybranches.Kakanumberstheforksby1toNandtherootisalwaysnumberedby1.Appleswillgrowontheforksandtwoapplewon'tgrowonthesamefork.kakawantstoknowhowmanyapplesarethereinasub-tree,forhisstudyoftheproduceabi...

    02014年8月1日6,903dfs序,线段树
  • NOI2007项链工厂

    NOI2007项链工厂

    Description Input输入文件第一行包含两个整数N,c,分别表示项链包含的珠子数目以及颜色数目。第二行包含N个整数,x1,x2…,xn,表示从位置1到位置N的珠子的颜色,1≤xi≤c。第三行包含一个整数Q,表示命令数目。接下来的Q行每行一条命令,如上文所述。Output对于每一个C和CS命令,应输出一个整数代表相应的答案。SampleInput53123214CR2P552CS41SampleOutput41HINT  对于60%的数据,N≤1000,Q≤1000...

    02014年7月31日5,611线段树
73 / 145 « 上一页 1 ...71 72 73 74 75 ...145 下一页 »