题目链接: http://acm.hdu.edu.cn/showproblem.php?pid=1598 find the most comfortable road Time Limit: 1000/1000 MS (Java/Others)Memory Limit: 32768/32768 K (Java/Others) 问题描述 XX星有许多城市,城市之间通过一种奇怪的高速公路SARS(Super Air Roam Structure---超级空中漫游结构)进行交流,每条SARS都对行驶在…
Supermarket Time Limit: 2000MS Memory Limit: 65536K Total Submissions: 17634 Accepted: 7920 题目链接:http://poj.org/problem?id=1456 Description: A supermarket has a set Prod of products on sale. It earns a profit px for each product x∈Prod sold by a…
F - Supermarket Time Limit:2000MS Memory Limit:65536KB 64bit IO Format:%I64d & %I64u Submit Status Practice POJ 1456 Appoint description: System Crawler (2015-11-30) Description A supermarket has a set Prod of products on sale. It earns a p…
畅通工程 Time Limit: 4000/2000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 29620 Accepted Submission(s): 15557 Problem Description 某省调查城镇交通状况,得到现有城镇道路统计表,表中列出了每条道路直接连通的城镇.省政府"畅通工程"的目标是使全省任何两个城镇间都可以实现交通(但不一定有…
题目链接:http://codeforces.com/problemset/problem/731/C 题意:有n只袜子,每只都有一个颜色,现在他的妈妈要去出差m天,然后让他每天穿第 L 和第 R 只袜子,他为了让每天穿的袜子都是一个颜色的,他需要把袜子涂色,共有k种颜色,求最少需要涂多少只袜子,才能保证他每天穿的袜子都是一样的. 用并查集把所有联系在一起的袜子放到一个集合中去,然后这些袜子会变成一块一块的,我们在每一块中找一种颜色最多的,然后把当前块中的其他袜子都涂成这种颜色即可,累加即可 #…
Conquer a New Region Time Limit: 8000/4000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 657 Accepted Submission(s): 179 Problem Description The wheel of the history rolling forward, our king conquered a new region i…
find the most comfortable road Time Limit: 1000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 7519 Accepted Submission(s): 3171 Problem Description XX星有许多城市,城市之间通过一种奇怪的高速公路SARS(Super Air Roam Structure---超级…
思路:这个题的并查集用的好NB啊, 我们把伤害看成图上的点,武器作为边,对于一个联通块来说, 如果是一棵大小为k的树,那么这个联通块里面有k - 1个伤害能被取到,如果图上有环那么k个值都能 取到,对于是一颗树的情况,我们肯定让里面最大的不取,这个用并查集维护一下,每次合并将小的 伤害合到大的伤害上,这样就能保证根是这个联通块的最大值. #include<bits/stdc++.h> #define LL long long #define fi first #define se second…
C. Rumor time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output Vova promised himself that he would never play computer games... But recently Firestorm — a well-known game developing company — pu…
<传送门> 128. Snake time limit per test: 0.25 sec. memory limit per test: 4096 KB There are N points given by their coordinates on a plane. All coordinates (xi,yi) are integers in a range from -10000 up to 10000 inclusive . It is necessary to construct…
题面 Time Limit: 10 Sec Memory Limit: 128 MB Submit: 136 Solved: 90 [Submit][Status][Discuss] Description The cross-country skiing course at the winter Moolympics is described by an M x N grid of elevations (1 <= M,N <= 500), each elevation being in t…
题目链接:Codeforces 437D The Child and Zoo 题目大意:小孩子去參观动物园,动物园分非常多个区,每一个区有若干种动物,拥有的动物种数作为该区的权值.然后有m条路,每条路的权值为该条路连接的两个区中权值较小的一个.假设两个区没有直接连接,那么f值即为从一个区走到还有一个区中所经过的路中权值最小的值做为权值.问,平均两个区之间移动的权值为多少. 解题思路:并查集+贪心.将全部的边依照权值排序,从最大的開始连接,每次连接时计算的次数为连接两块的节点数的积(乘法原理).…
find the most comfortable road Time Limit: 1000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 3240 Accepted Submission(s): 1373 Problem Description XX星有许多城市,城市之间通过一种奇怪的高速公路SARS(Super Air Roam Structure---超级…