随笔分类 -  模仿树形dp

摘要:DescriptionAkiba is a dangerous country since a bloodsucker living there. Sometimes the bloodsucker will appear and kill everyone who isn't at his hometown. One day, a brave person named CC finds a treasure map, and he wants to get as much as possible.Akiba consists ofntowns andn-1roads. There i 阅读全文
posted @ 2013-11-23 16:47 persistent codeants 阅读(203) 评论(0) 推荐(0)
摘要:DescriptionHumans have discovered a kind of new metal mineral on Mars which are distributed in point�like with paths connecting each of them which formed a tree. Now Humans launches k robots on Mars to collect them, and due to the unknown reasons, the landing site S of all robots is identified in ad 阅读全文
posted @ 2013-10-07 12:46 persistent codeants 阅读(172) 评论(0) 推荐(0)
摘要:The cows have reconstructed Farmer John's farm, with its N barns (1 6 #include 7 #include 8 #include 9 #include10 using namespace std;11 #define INF 0x3f3f3f3f12 struct node13 {14 int v,next;15 }e[1001];16 int head[1001],I;17 int dp[181][181][181];18 int ch[1001],n,p,i;19 int a,b,res;20 int mi.. 阅读全文
posted @ 2013-09-27 20:34 persistent codeants 阅读(163) 评论(0) 推荐(0)
摘要:Problem DescriptionIn the new ACM-ICPC Regional Contest, a special monitoring and submitting system will be set up, and students will be able to compete at their own universities. However there’s one problem. Due to the high cost of the new judging system, the organizing committee can only afford to 阅读全文
posted @ 2013-09-12 21:46 persistent codeants 阅读(237) 评论(0) 推荐(0)
摘要:Problem DescriptionWshxzt is a lovely girl. She likes apple very much. One day HX takes her to an apple tree. There are N nodes in the tree. Each node has an amount of apples. Wshxzt starts her happy trip at one node. She can eat up all the apples in the nodes she reaches. HX is a kind guy. He knows 阅读全文
posted @ 2013-08-21 17:54 persistent codeants 阅读(323) 评论(0) 推荐(0)
摘要:1463. Happiness to People!Time limit: 1.0 second Memory limit: 64 MBEvery Santa Claus wants to surprise children with his presents. This year Santa Claus Petrovich wants to surprise children of remote Cuckooland. He is sure that in order to make a real impression he should choose a route without rep 阅读全文
posted @ 2013-08-13 17:42 persistent codeants 阅读(362) 评论(0) 推荐(0)
摘要:Let's imagine how apple tree looks in binary computer world. You're right, it looks just like a binary tree, i.e. any biparous branch splits up to exactly two new branches. We will enumerate by integers the root of binary apple tree, points of branching and the ends of twigs. This way we may 阅读全文
posted @ 2013-08-01 13:52 persistent codeants 阅读(288) 评论(0) 推荐(0)