1503 愚蠢的宠物 1 #include<iostream> 2 #include<algorithm> 3 #include<cstring> 4 using namespace std; 5 6 #define maxn 1000000+100 7 int father[maxn]; 8 in ...
分类:
其他好文 时间:
2017-09-11 13:09:21
阅读次数:
184
Description "Good man never makes girls wait or breaks an appointment!" said the mandarin duck father. Softly touching his little ducks' head, he told ...
分类:
其他好文 时间:
2017-09-08 23:55:38
阅读次数:
348
自己总结一下继承的格式 class Father: def__init__(self,Y1,Y2): self.X1=Y1 selfX2=Y2 def tell(self): print’this is “%s”and”%s”:’%(self.X1,self.X2) class son(Father ...
分类:
编程语言 时间:
2017-09-06 13:08:02
阅读次数:
155
题目链接 Problem Description You are given a complete binary tree with n nodes. The root node is numbered 1, and node x's father node is ?x/2?. At the beg ...
分类:
其他好文 时间:
2017-09-01 20:29:35
阅读次数:
305
Remmarguts' Date Description "Good man never makes girls wait or breaks an appointment!" said the mandarin duck father. Softly touching his little duc ...
分类:
其他好文 时间:
2017-08-22 20:50:52
阅读次数:
202
HazelFan wants to build a rooted tree. The tree has nn nodes labeled 0 to n?1, and the father of the node labeled i is the node labeled . HazelFan won ...
分类:
其他好文 时间:
2017-08-22 19:49:41
阅读次数:
136
【题目链接】 http://acm.hdu.edu.cn/showproblem.php?pid=6141 【题目大意】 给出一个有向图,求1点为根的最小树形图使得第n个点的直接父亲编号最小 【题解】 如果没有第n个点直接父亲编号最小的要求, 那么只要跑一遍朱刘算法即可,考虑到直接父亲最小的条件, ...
分类:
其他好文 时间:
2017-08-21 14:00:39
阅读次数:
189
最小树形图,却不知道怎么求n的父亲,直到看到一篇大佬题解;http://blog.csdn.net/mr__kid/article/details/77371066 分析:首先,这里求的是最大树形图,我们可以将所有边的权值乘以-1,然后根据最小树形图算法,求出最小树形图的权值和,再乘回-1就是该有向 ...
分类:
其他好文 时间:
2017-08-18 23:51:40
阅读次数:
220
http://acm.hdu.edu.cn/showproblem.php?pid=6141 题意: 求最大树形图。 思路: 把边的权值变为负值,那么这就是个最小树形图了,直接套模板就可以解决。 有个问题就是n结点的父亲结点的编号要尽量小,这里有个技巧可以用,权值编码,将所有边的权值都放大1000倍 ...
分类:
其他好文 时间:
2017-08-18 18:32:28
阅读次数:
161
题意:给你一张带权有向图,让你求最大树形图。并在此前提下令n号结点父亲的编号最小。 比赛的时候套了个二分,TLE了。 实际上可以给每个边的权值乘1000,对于n号结点的父边,加上(999-父结点编号)大小的权值,这样即可保证最大树形图的前提下,n号结点父亲的编号最小。 网上找了个朱-刘算法的板子,把 ...
分类:
编程语言 时间:
2017-08-18 00:05:45
阅读次数:
254