ZOJ 3820 2014ACM/ICPC牡丹江司B称号】的更多相关文章

3797714 2014 - 10 - 12 21:58 : 19 Accepted 3820 C++ 1350 70240 zz_1215 比較麻烦的一道题吧,開始的时候不停的段异常,后面知道是爆栈了,然后用数组模拟递归,才ac了 思路挺简单的,先找到这个树的直径,单独拿出来,能够证明最后选的两个点一定是在直径上的.我就不证了 然后求出这条直径上的每一个点向外延伸的最远距离 对这个距离做两次RMQ,第一次是对于往左边计算最大距离,所以要这个距离的序列要依次+1,+2,+3.......+n-1…
Average Score Time Limit: 2 Seconds      Memory Limit: 131072 KB Bob is a freshman in Marjar University. He is clever and diligent. However, he is not good at math, especially in Mathematical Analysis. After a mid-term exam, Bob was anxious about his…
Domination Time Limit: 8 Seconds      Memory Limit: 131072 KB      Special Judge Edward is the headmaster of Marjar University. He is enthusiastic about chess and often plays chess with his friends. What's more, he bought a large decorative chessboar…
周六周末组队训练赛. Dogs' Candies Time Limit: 30000/30000 MS (Java/Others)    Memory Limit: 512000/512000 K (Java/Others)Total Submission(s): 3920    Accepted Submission(s): 941 Problem Description Far far away, there live a lot of dogs in the forest. Unlike…
Little Zu Chongzhi's Triangles Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 512000/512000 K (Java/Others)Total Submission(s): 2515    Accepted Submission(s): 1427 Problem Description Zu Chongzhi (429–500) was a prominent Chinese mathematic…
Song Jiang's rank list Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 512000/512000 K (Java/Others)Total Submission(s): 2006    Accepted Submission(s): 1128 Problem Description <Shui Hu Zhuan>,also <Water Margin>was written by Shi Nai…
题目链接:zoj 3820 Building Fire Stations 题目大意:给定一棵树.选取两个建立加油站,问说全部点距离加油站距离的最大值的最小值是多少,而且随意输出一种建立加油站的方式. 解题思路:二分距离推断,推断函数的复杂度是o(n),这种复杂度应该是o(nlogn).即使常数系数偏大,可是竟然跑了4.5s,也是醉了. 推断函数里面做了3次bfs,可是每次bfs节点最多遍历1次,首先任取一点做根建立一个树,找到深度最大的节点.以向上移动L(推断的ans)位置处的节点建立加油站,并…
Average Score Time Limit: 2 Seconds      Memory Limit: 65536 KB Bob is a freshman in Marjar University. He is clever and diligent. However, he is not good at math, especially in Mathematical Analysis. After a mid-term exam, Bob was anxious about his…
Known Notation Time Limit: 2 Seconds      Memory Limit: 65536 KB Do you know reverse Polish notation (RPN)? It is a known notation in the area of mathematics and computer science. It is also known as postfix notation since every operator in an expres…
Information Entropy Time Limit: 2 Seconds      Memory Limit: 65536 KB      Special Judge Information Theory is one of the most popular courses in Marjar University. In this course, there is an important chapter about information entropy. Entropy is t…