2013年4月8日

Codeforces 144D. Missile Silos 最短路

摘要: D. Missile Silostime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputA country called Berland consists ofncities, numbered with integer numbers from1ton. Some of them are connected by bidirectional roads. Each road has some length. There is a path fro 阅读全文

posted @ 2013-04-08 15:31 电子幼体 阅读(190) 评论(0) 推荐(0) 编辑

Codeforces 117C. Cycle 寻找环

摘要: C. Cycletime limit per test2.5 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputAtournamentis a directed graph without self-loops in which every pair of vertexes is connected by exactly one directed edge. That is, for any two vertexesuandv(u ≠ v) exists either an edge 阅读全文

posted @ 2013-04-08 15:21 电子幼体 阅读(218) 评论(0) 推荐(0) 编辑

Codeforces 25D. Roads not only in Berland 并查集

摘要: D. Roads not only in Berlandtime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputBerland Government decided to improve relations with neighboring countries. First of all, it was decided to build new roads so that from each city of Berland and neighbor 阅读全文

posted @ 2013-04-08 15:19 电子幼体 阅读(182) 评论(0) 推荐(0) 编辑

Codeforces 61D. Eternal Victory 树的性质

摘要: D. Eternal Victorytime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputValerian was captured by Shapur. The victory was such a great one that Shapur decided to carve a scene of Valerian's defeat on a mountain. So he had to find the best place to m 阅读全文

posted @ 2013-04-08 15:16 电子幼体 阅读(323) 评论(0) 推荐(0) 编辑

Codeforces 28B. pSort 连通性

摘要: B. pSorttime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputOne dayncells of some array decided to play the following game. Initially each cell contains a number which is equal to it's ordinal number (starting from1). Also each cell determined it 阅读全文

posted @ 2013-04-08 15:10 电子幼体 阅读(395) 评论(0) 推荐(0) 编辑

2013年4月7日

朴素的dijkstra模板

摘要: void dijkstra(int n,int dist[],EDGE edges[],int pre[],int src,int dest) { int _min,u,v,w; bool visit[maxn]={0}; for (int i=1;i<=n;i++) { dist[i]=OO; } dist[src]=0; for (int loop=1; loop<=n; loop++) { u=0; _min=OO; for (int i=1; i<=n; i+... 阅读全文

posted @ 2013-04-07 20:53 电子幼体 阅读(161) 评论(0) 推荐(0) 编辑

2013年4月6日

Codeforecs 65D. Harry Potter and the Sorting Hat 一种新的记忆化搜索方式

摘要: D. Harry Potter and the Sorting Hattime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputAs you know, Hogwarts has four houses: Gryffindor, Hufflepuff, Ravenclaw and Slytherin. The sorting of the first-years into houses is done by the Sorting Hat. The 阅读全文

posted @ 2013-04-06 20:02 电子幼体 阅读(271) 评论(0) 推荐(0) 编辑

NEFU 644 touring compute 最短路

摘要: touring computeTime Limit 1000msMemory Limit 65536KdescriptionThe best friends Mr. Li and Mr. Liu are touring in beautiful country M. M has n cities and m two-way roads in total. Each road connects two cities with fixed length.We assume that the cost of car traveling on the road is only related ... 阅读全文

posted @ 2013-04-06 18:20 电子幼体 阅读(159) 评论(0) 推荐(0) 编辑

NEFU 642 monkey 记忆化搜索

摘要: monkeyTime Limit 1000msMemory Limit 65536Kdescription Cc is a lovely monkey. It likes to play the game "catching plates". The game is as follows. There are n pegs in a line numbered from 1 to n. Cc stands on the first peg at the beginning. It is rather hard for Cc to jump from peg i to peg 阅读全文

posted @ 2013-04-06 18:17 电子幼体 阅读(151) 评论(0) 推荐(0) 编辑

NEFU 641 素数树

摘要: 素数树Time Limit 1000msMemory Limit 65536KdescriptionSuppose there is a tree named A. All nodes of A have a weight v(0 < v < 4000000).Now, we will give the definition of "Prime Node".A node is a Prime Node if the following conditions are satisfied.The subtree of A whose root node is b w 阅读全文

posted @ 2013-04-06 18:15 电子幼体 阅读(183) 评论(0) 推荐(0) 编辑

导航