Moving Tables Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 20302    Accepted Submission(s): 6889 Problem Description The famous ACM (Advanced Computer Maker) Company has rented a floor of a…
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1050 AC code: #include<stdio.h> #include<string.h> int m[210]; int main(void) { int t,n,i,j,st,en,ma; scanf("%d",&t); while(t--) { memset(m,0,sizeof(m)); scanf("%d",&n)…
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1050 这道题目隔了很久才做出来的.一开始把判断走廊有重叠的算法都想错了.以为重叠只要满足,下一次moving的起始room小于或等于上一次moving的结束room则证明有重复.这样只能保证局部不能同时进行moving,但是根本得不出其他moving哪些是可以同时进行搬动的. 正确的思路是,统计最大的重叠数,再乘以10即可.具体做法:把每个房间之间的走廊作为一个统计单位,当所有的办公桌都搬运完成之后…
http://acm.hdu.edu.cn/showproblem.php?pid=1050 这个题我首先直接用的常规贪心,用的和那个尽可能看更多完整节目那种思路.但是.......一直WA....T_T.... 后来在网上搜了一下这个题,发现好多人都有问题,都没有求出来,基本上都用的对尾部排序求的方法. 其实这个题因为是两排房间,所以1和2公用一个走廊,其中一个在需要移动的时候宁外一个还是不能移动. 所以我后面改了思路,直接改成了用两次排序直接找里面重叠部分最多的.(尾部排序的时候也要处理走廊…
http://acm.hdu.edu.cn/showproblem.php?pid=1050 当时这道题被放在了贪心专题,我又刚刚做了今年暑假不AC所以一开始就在想这肯定是个变过型的复杂贪心,但是后来看了题解用了巨简单的做法,统计每个点被几个区间覆盖过,找最多的那个就是答案了 感觉这种做法和物理里的动能定理啥的有点像(也不太恰当)(其实就是忽略全部具体过程,只看结果(?))…
Problem - 1050 过两天要给12的讲贪心,于是就做一下水贪心练习练习. 代码如下: #include <cstdio> #include <iostream> #include <algorithm> #include <cstring> #include <set> #include <vector> using namespace std; typedef pair<int, int> PII; typed…
题意:在一个走廊两边都有对称分布的连续房间,现在有n张桌子需要从a移动到b房间.每次移动需要10分钟, 但是如果两次移动中需要经过相同的走廊位置,则不能同时进行,需要分开移动.最后求最少需要多长时间移动完所有的桌子. 析:这应该是一个贪心算法,时间尽量少,但是在一走廊如果相遇,必然是要分开的,所以说,我们只要统计, 统计在每个走廊的相遇的次数,然后再取最大值,如果最大值都成立了,那么其他的也会成立(想一下,为什么). 你想一下,假设有另一个走廊,次数比它少,即使他们的桌子不相同,而其他那些可以在…
题意:有400间房间按题目中图片所给的方式排列,然后给出要移动的n张桌子所要移动的范围,每张桌子要移动的范围不能出现重叠的区域:问最少要多少次才能移动完所有的桌子. 题解思路:把题目转换下,就是有n个区间,每次可以去除掉k个没有重叠部分的区间,最少要多少次能去掉所有区间.妥妥的,,贪心.可能会有人联想到经典的“区间调度问题”.但很遗憾,在这里行不通:区间调度问题是按区间右端排序后尽可能选取结束时间早的,但这种贪心只是一次性选取尽可能多的区间,而本题是要求选取完所有区间所要花费次数最少.从整体上看…
题意:你搬n个桌子,桌子从一个地方搬到另一个地方,走廊只允许同时一个桌子通过,教室分布在两边,奇数在一边,偶数在一边,当桌子不冲突时可以同时搬运,冲突时要等别的那个桌子搬完再搬. 思路:因为奇数桌子在偶数对面,当奇数时会与偶数冲突,直接把奇数+1,变成偶数就可以很简单判断出有没冲突,再判断那个位置冲突最多,就是最后的结果. #include<iostream> #include<cstdio> #include<cmath> #include<cstring>…
Moving Tables Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 14418    Accepted Submission(s): 4939 Problem Description The famous ACM (Advanced Computer Maker) Company has rented a floor of a b…
Moving Tables Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 20344    Accepted Submission(s): 6900 Problem Description The famous ACM (Advanced Computer Maker) Company has rented a floor of a…
Moving Tables Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 24316    Accepted Submission(s): 8053 Problem Description The famous ACM (Advanced Computer Maker) Company has rented a floor of a b…
 Moving Tables Time Limit: 1 Sec  Memory Limit: 64 MB Submit: 1182  Solved: 563 Description The famous ACM (Advanced Computer Maker) Company has rented a floor of a building whose shape is in the following figure. The floor has 200 rooms each on the…
Moving Tables Time Limit: 1000MS   Memory Limit: 10000K Total Submissions: 28304   Accepted: 9446 Description The famous ACM (Advanced Computer Maker) Company has rented a floor of a building whose shape is in the following figure. The floor has 200…
解题思路: 这种做法是基于hdu2037的做法上考虑的,找出所有可以同时搬运的桌子,然后就很方便求出最短总时间. 还有一种更简单的做法是直接遍历一遍找出与别的重复次数最多的那片区域,重复次数*10就可以得到结果. Moving Tables Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 28033    Accepted Submis…
Moving Tables Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 45555    Accepted Submission(s): 14817 Problem Description The famous ACM (Advanced Computer Maker) Company has rented a floor of a…
Problem Description The famous ACM (Advanced Computer Maker) Company has rented a floor of a building whose shape is in the following figure. The floor has 200 rooms each on the north side and south side along the corridor. Recently the Company made…
Problem Description The famous ACM (Advanced Computer Maker) Company has rented a floor of a building whose shape is in the following figure. The floor has 200 rooms each on the north side and south side along the corridor. Recently the Company made…
贪心问题,其实我觉得贪心就是合理的考虑最优情况,证明贪心可行即可.这题目没话多久一次ac.这道题需要注意房间号的奇偶性.1 3.2 4的测试数据.答案应该为20. #include <stdio.h> #include <stdlib.h> #define MAXNUM 505 ]; int visit[MAXNUM]; int comp(const void *a, const void *b) { return *(int *)a - *(int *)b; } int main…
The famous ACM (Advanced Computer Maker) Company has rented a floor of a building whose shape is in the following figure. The floor has 200 rooms each on the north side and south side along the corridor. Recently the Company made a plan to reform its…
http://acm.hdu.edu.cn/showproblem.php? pid=1050 Moving Tables Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 18850    Accepted Submission(s): 6440 Problem Description The famous ACM (Advanced…
pid=1050">Moving Tables Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 19156    Accepted Submission(s): 6532 Problem Description The famous ACM (Advanced Computer Maker) Company has rented…
Moving Tables Time Limit : 2000/1000ms (Java/Other)   Memory Limit : 65536/32768K (Java/Other) Total Submission(s) : 21   Accepted Submission(s) : 11 Font: Times New Roman | Verdana | Georgia Font Size: ← → Problem Description The famous ACM (Advance…
题目连接:2326 - Moving Tables 题目大意:在一个走廊上有400个教室, 先在有一些桌子要移动, 每次移动需要十分钟, 但是不同房间的桌子可以在同一个十分钟内移动,只要走廊没有被占用就可以, 注意教室序号1 和 2 是在对面. 注意:给出的区间没有分左边或者是右边比较大. 解题思路:区间覆盖问题, 将所有给出的区间处理一下, 去除对面房间这样的情况. 让后将区间按照l 和 r 的值进行排序, 然后看进行几次区间覆盖可以使得所有区间均被用上. #include <stdio.h>…
B - Moving Tables Time Limit:1000MS     Memory Limit:32768KB     64bit IO Format:%I64d & %I64u Submit Status Description The famous ACM (Advanced Computer Maker) Company has rented a floor of a building whose shape is in the following figure.  The fl…
POJ 2342 Anniversary party / HDU 1520 Anniversary party / URAL 1039 Anniversary party(树型动态规划) Description There is going to be a party to celebrate the 80-th Anniversary of the Ural State University. The University has a hierarchical structure of emp…
POJ1083 Moving Tables Time Limit: 1000MS   Memory Limit: 10000K Total Submissions: 35297   Accepted: 11774 Description The famous ACM (Advanced Computer Maker) Company has rented a floor of a building whose shape is in the following figure. The floor…
POJ 2711 Leapin' Lizards / HDU 2732 Leapin' Lizards / BZOJ 1066 [SCOI2007]蜥蜴(网络流,最大流) Description Your platoon of wandering lizards has entered a strange room in the labyrinth you are exploring. As you are looking around for hidden treasures, one of…
Moving Tables Problem Description The famous ACM (Advanced Computer Maker) Company has rented a floor of a building whose shape is in the following figure. The floor has 200 rooms each on the north side and south side along the corridor. Recently the…
Moving Tables Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 40796    Accepted Submission(s): 13405 Problem Description The famous ACM (Advanced Computer Maker) Company has rented a floor of a…