摘要:// 给你一颗树 选一个点,从这个点出发到其它所有点的权值和最大// i 到 j的最大权值为 i到j所经历的树边容量的最小值// 第一感觉是树上的dp// 后面发现不可以// 看了题解说是并查集// 然后发现这不就是在最小生成树那个模板上做其它操作吗、、// 的确是好题#include #include #include #include #include using namespace std;#define maxn 200010#define LL long longstruct Eg{ int a,b,w; bool operatort.w; }}E[maxnsv){ ...
阅读全文
摘要:Problem Description自从Lele开发了Rating系统,他的Tetris事业更是如虎添翼,不久他遍把这个游戏推向了全球。为了更好的符合那些爱好者的喜好,Lele又想了一个新点子:他将制作一个全球Tetris高手排行榜,定时更新,名堂要比福布斯富豪榜还响。关于如何排名,这个不用说都知道是根据Rating从高到低来排,如果两个人具有相同的Rating,那就按这几个人的RP从高到低来排。终于,Lele要开始行动了,对N个人进行排名。为了方便起见,每个人都已经被编号,分别从0到N-1,并且编号越大,RP就越高。同时Lele从狗仔队里取得一些(M个)关于Rating的信息。这些信息可能
阅读全文
摘要:Problem DescriptionXX 星有许多城市,城市之间通过一种奇怪的高速公路SARS(Super Air Roam Structure---超级空中漫游结构)进行交流,每条SARS都对行驶在上面的Flycar限制了固定的Speed,同时XX星人对 Flycar的“舒适度”有特殊要求,即乘坐过程中最高速度与最低速度的差越小乘坐越舒服 ,(理解为SARS的限速要求,flycar必须瞬间提速/降速,痛苦呀 ),但XX星人对时间却没那么多要求。要你找出一条城市间的最舒适的路径。(SARS是双向的)。Input输入包括多个测试实例,每个实例包括:第一行有2个正整数n (1<n<=
阅读全文
摘要:Play on WordsTime Limit: 10000/5000 MS (Java/Others)Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 3149Accepted Submission(s): 1002Problem DescriptionSome of the secret doors contain a very interesting word puzzle. The team of archaeologists has to solve it to open that doors. Because
阅读全文
摘要:A Bug's LifeTime Limit: 10000MSMemory Limit: 65536KTotal Submissions: 21605Accepted: 7043DescriptionBackground Professor Hopper is researching the sexual behavior of a rare species of bugs. He assumes that they feature two different genders and that they only interact with bugs of the opposite g
阅读全文
摘要:Wireless NetworkTime Limit: 10000MSMemory Limit: 65536KTotal Submissions: 12374Accepted: 5217DescriptionAn earthquake takes place in Southeast Asia. The ACM (Asia Cooperated Medical team) have set up a wireless network with the lap computers, but an unexpected aftershock attacked, all computers in t
阅读全文
摘要:Parity gameTime Limit: 1000MSMemory Limit: 65536KTotal Submissions: 4587Accepted: 1799DescriptionNow and then you play the following game with your friend. Your friend writes down a sequence consisting of zeroes and ones. You choose a continuous subsequence (for example the subsequence from the thir
阅读全文
摘要:Problem 1924 死锁 Accept: 93Submit: 244Time Limit: 1000 mSecMemory Limit : 32768 KB Problem Description在操作系统中存在着死锁问题。 进程在执行过程中,因争夺资源而造成的一种互相等待的现象,若无外力作用,它们都将无法推进下去。此时称系统处于死锁状态或系统产生了死锁,这些永远在互相等待的进程称为死锁进程。由于资源占用是互斥的,当某个进程提出申请资源后,使得有关进程在无外力协助下,永远分配不到必需的资源而无法继续运行,这就产生了死锁。 例如,如果线程A占用了资源1并等待资源2,而线程B占用了资源2并.
阅读全文
摘要:Find them, Catch themTime Limit: 1000MSMemory Limit: 10000KTotal Submissions: 21108Accepted: 6259DescriptionThe police office in Tadu City decides to say ends to the chaos, as launch actions to root up the TWO gangs in the city, Gang Dragon and Gang Snake. However, the police first needs to identify
阅读全文
摘要:食物链Time Limit: 1000MSMemory Limit: 10000KTotal Submissions: 29454Accepted: 8591Description动物王国中有三类动物A,B,C,这三类动物的食物链构成了有趣的环形。A吃B, B吃C,C吃A。 现有N个动物,以1-N编号。每个动物都是A,B,C中的一种,但是我们并不知道它到底是哪一种。有人用两种说法对这N个动物所构成的食物链关系进行描述:第一种说法是"1 X Y",表示X和Y是同类。第二种说法是"2 X Y",表示X吃Y。此人对N个动物,用上述两种说法,一句接一句地说出K句
阅读全文
摘要:Cube StackingTime Limit: 2000MSMemory Limit: 30000KTotal Submissions: 14175Accepted: 4773Case Time Limit: 1000MSDescriptionFarmer John and Betsy are playing a game with N (1 <= N <= 30,000)identical cubes labeled 1 through N. They start with N stacks, each containing a single cube. Farmer John
阅读全文
摘要:Farm IrrigationTime Limit: 2000/1000 MS (Java/Others)Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 2492Accepted Submission(s): 1107Problem DescriptionBenny has a spacious farm land to irrigate. The farm land is a rectangle, and is divided into a lot of samll squares. Water pipes are
阅读全文
摘要:More is betterTime Limit: 5000/1000 MS (Java/Others)Memory Limit: 327680/102400 K (Java/Others)Total Submission(s): 5725Accepted Submission(s): 2127Problem DescriptionMr Wang wants some boys to help him with a project. Because the project is rather complex, the more boys come, the better it will be.
阅读全文
摘要:How Many TablesTime Limit: 2000/1000 MS (Java/Others)Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 5629Accepted Submission(s): 2662Problem DescriptionToday is Ignatius' birthday. He invites a lot of friends. Now it's dinner time. Ignatius wants to know how many tables he need
阅读全文
摘要:Ubiquitous ReligionsTime Limit: 5000MSMemory Limit: 65536KTotal Submissions: 17089Accepted: 8283DescriptionThere are so many different religions in the world today that it is difficult to keep track of them all. You are interested in finding out how many different religions students in your universi
阅读全文
摘要:Graph’s Cycle ComponentTime Limit: 2000/1000 MS (Java/Others)Memory Limit: 131072/65536 K (Java/Others)Total Submission(s): 1275Accepted Submission(s): 499Problem DescriptionIn graph theory, a cycle graph is an undirected graph that consists of a single cycle, or in other words, some number of verti
阅读全文
摘要:The SuspectsTime Limit: 1000MSMemory Limit: 20000KTotal Submissions: 14589Accepted: 6957DescriptionSevere acute respiratory syndrome (SARS), an atypical pneumonia of unknown aetiology, was recognized as a global threat in mid-March 2003. To minimize transmission to others, the best strategy is to se
阅读全文
摘要:Problem Description上次Gardon的迷宫城堡小希玩了很久(见Problem B),现在她也想设计一个迷宫让Gardon来走。但是她设计迷宫的思路不一样,首先她认为所有的通道都应该是双向连通的,就是说如果有一个通道连通了房间A和B,那么既可以通过它从房间A走到房间B,也可以通过它从房间B走到房间A,为了提高难度,小希希望任意两个房间有且仅有一条路径可以相通(除非走了回头路)。小希现在把她的设计图给你,让你帮忙判断她的设计图是否符合她的设计思路。比如下面的例子,前两个是符合条件的,但是最后一个却有两种方法从5到达8。 Input输入包含多组数据,每组数据是一个以0 0结尾的整数
阅读全文
摘要:Problem Description某省调查城镇交通状况,得到现有城镇道路统计表,表中列出了每条道路直接连通的城镇。省政府“畅通工程”的目标是使全省任何两个城镇间都可以实现交通(但不一定有直接的道路相连,只要互相间接通过道路可达即可)。问最少还需要建设多少条道路?Input测试输入包含若干测试用例。每个测试用例的第1行给出两个正整数,分别是城镇数目N ( < 1000 )和道路数目M;随后的M行对应M条道路,每行给出一对正整数,分别是该条道路直接连通的两个城镇的编号。为简单起见,城镇从1到N编号。 注意:两个城市之间可以有多条道路相通,也就是说 3 3 1 2 1 2 2 1 这种输入
阅读全文
摘要:题目连接http://acm.hdu.edu.cn/showproblem.php?pid=1325http://poj.org/problem?id=1308在POJ上WA了,看来还是有问题的呀#include <iostream>#include <cstdio>#include <string.h>using namespace std;int hr[100003],hs[100003];int mer[100003];int main(){ // freopen("in.txt","r",stdin); int
阅读全文