1050 Moving Tables
Moving Tables
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)
Total Submission(s): 20344 Accepted Submission(s): 6900
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 system. The reform includes moving a lot of tables between rooms. Because the corridor is narrow and all the tables are big, only one table can pass through the corridor. Some plan is needed to make the moving efficient. The manager figured out the following plan: Moving a table from a room to another room can be done within 10 minutes. When moving a table from room i to room j, the part of the corridor between the front of room i and the front of room j is used. So, during each 10 minutes, several moving between two rooms not sharing the same part of the corridor will be done simultaneously. To make it clear the manager illustrated the possible cases and impossible cases of simultaneous moving.
For each room, at most one table will be either moved in or moved out. Now, the manager seeks out a method to minimize the time to move all the tables. Your job is to write a program to solve the manager’s problem.
#include<stdio.h>
#include<math.h>
#include<stdlib.h>
#include<string.h>
#include<iostream>
#include<algorithm>
using namespace std;
struct ln{
int x;
int y;
}a[];
int main()
{
//freopen("in.txt","r",stdin);
int t;
int c[];
scanf("%d",&t);
while(t--)
{
memset(a,,sizeof(a));
memset(c,,sizeof(c));
int n,swap;
scanf("%d",&n);
for(int i=;i<n;i++)
{
scanf("%d%d",&a[i].x,&a[i].y);
if(a[i].x%==)
a[i].x=a[i].x/;
else
a[i].x=a[i].x/+;
if(a[i].y%==)
a[i].y=a[i].y/;
else
a[i].y=a[i].y/+;
if(a[i].x>a[i].y)
{
swap=a[i].x;
a[i].x=a[i].y;
a[i].y=swap;
}
for(int j=a[i].x;j<=a[i].y;j++)
{
c[j]++;
}
}
//sort(a,a+n,cmp);
int max=;
for(int i=;i<=;i++)
{
if(c[i]>max)
max=c[i];
}
printf("%d\n",max*);
}
return ;
}
1050 Moving Tables的更多相关文章
- HDOJ 1050 Moving Tables
Moving Tables Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Tot ...
- hdoj 1050 Moving Tables【贪心区间覆盖】
Moving Tables Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Tot ...
- POJ 1083 && HDU 1050 Moving Tables (贪心)
Moving Tables Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others) To ...
- hdu 1050 Moving Tables 解题报告
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1050 这道题目隔了很久才做出来的.一开始把判断走廊有重叠的算法都想错了.以为重叠只要满足,下一次mov ...
- HDU ACM 1050 Moving Tables
Problem Description The famous ACM (Advanced Computer Maker) Company has rented a floor of a buildin ...
- Hdoj 1050.Moving Tables 题解
Problem Description The famous ACM (Advanced Computer Maker) Company has rented a floor of a buildin ...
- --hdu 1050 Moving Tables(贪心)
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1050 AC code: #include<stdio.h> #include<str ...
- hdu 1050 Moving Tables
http://acm.hdu.edu.cn/showproblem.php?pid=1050 这个题我首先直接用的常规贪心,用的和那个尽可能看更多完整节目那种思路.但是.......一直WA....T ...
- HDU – 1050 Moving Tables
http://acm.hdu.edu.cn/showproblem.php?pid=1050 当时这道题被放在了贪心专题,我又刚刚做了今年暑假不AC所以一开始就在想这肯定是个变过型的复杂贪心,但是后来 ...
随机推荐
- 《LDAP服务器和客户端的加密认证》RHEL6——第二篇 运维工程师必考
服务端的配置: (基于原先配好的ldap服务器)打开加密认证: Iptables –F setenforce 0 1.编辑ldap的配置文件:slapd.conf 2.启动ldap服务器: 3.切换 ...
- NSS_10 EXTJS给弹出的子窗口传递参数
在桌面程序中, 如果需要弹出一个子面板, 并且需要传一些参数给子面板, 我通常的作法就是:在子面板添加对应的数据成员,然后一个构造函数来接收这些参数并赋值级数据成员. 实现起来非常方便. 但是在Ext ...
- IOS_设置启动图片若干问题
在做项目时, 发现设置了LaunchImage时发现一些问题: 1. 启动图片的设置可以通过两种方法: 1) 通过在LaunchScreen里放入ImageView 并设置图片, 这种方法的好处在于不 ...
- php读取html并截取字符串
一般php采集代码能用的到,这里只是简单的实现代码. <?php $title='脚本学堂'; $hello='jbxue.com!'; $file=file_get_contents('htt ...
- QQ好友列表向左滑动出现置顶、删除--第三方开源--SwipeMenuListView
SwipeMenuListView是在github上的第三方开源项目,该项目在github上的链接地址是:https://github.com/baoyongzhang/SwipeMenuListVi ...
- Delphi XE5教程4:程序和单元概述
内容源自Delphi XE5 UPDATE 2官方帮助<Delphi Reference>,本人水平有限,欢迎各位高人修正相关错误!也欢迎各位加入到Delphi学习资料汉化中来,有兴趣者可 ...
- 关于IOS中的delegate必须知道的事情
当你开始写iOS程式不久,应该开始面对到很多的delegate, 不管是用别人的library或是自己写library,可能都逃不了delegate. 为了怕有些人不知道什么是delegate,在这边 ...
- ActiveMQ使用记录
1.在Linux中安装ActiveMQ 官方文档地址:http://activemq.apache.org/getting-started.html#GettingStarted-StartingAc ...
- iOS 进阶 第四天(0329)
0329 UIScrollView的常见属性及其解释 常见属性,如下图: 具体解释,如下图: 喜马拉雅设置的例子 代码: 效果
- xcode 编译错误的 之 头文件 包含成.m了
duplicate symbol _OBJC_CLASS_$_AutoTableViewViewController in: /Users/apple/Library/Developer/Xcode/ ...