HDOJ1050
Moving Tables
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)
Total Submission(s): 16129 Accepted Submission(s): 5542

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.
3 4 10 20 30 40 50 60 70 80 2 1 3 2 200 3 10 100 20 80 30 50
10 20 30
这道题目很有意思!所以拿上来了!
贴代码说明自己太懒了!
别人的思路!
其实重合线段最多的一部分就是答案!这个仔细想想!
因为重合多的地方一定要分开弄!
注意:房间一侧都是隔着1个数!
所以还要预处理下!
主要代码:
HDOJ1050的更多相关文章
- hdoj1050 Moving Tables(贪心)
题目链接 http://acm.hdu.edu.cn/showproblem.php?pid=1050 题意 有一条走廊,走廊两边各有200个房间,一边的房间编号是奇数,另一边是偶数.现在有n个箱子需 ...
随机推荐
- svn的使用!!!
1.SVN:subversion(子级源代码版本控制管理软件) 2.SVN的作用 (1)避免开发同一项目不会出现代码覆盖. (2)同一文件可以创建许多不同的版本,并可以随时查看不同版本的内容. (3) ...
- jquery.tmpl 用法(附上详细案例)
js的模板引擎就和服务端的差不多,都是更好更快的拼接html用于显示,我参考了文章:http://www.cnblogs.com/zhuzhiyuan/p/3510175.html tmpl常用标签 ...
- 关于垃圾回收(GC和Marshal)有感
最近做一个挂机软件.要求是挂个三四天没事,不会报错.开始的时候都是顺利的,所有步骤都是可以ok.但是当测试运行的是就出现问题了,内存居然会在一个Task跑完之后暴涨几M的内存.开了一台测试机测试了一天 ...
- 在EF的code frist下写稳健的权限管理系统:开篇(一)
环境:EF6.0.0.0+Autofac3.5.0.0+MVC4.0+pure6.0+Jquery IDE:vs2012,数据库:vs2008r2 搭建环境如下: 我给它取名字为cactus:仙人球, ...
- Unity加入Android广告小结
在Unity游戏加入广告大致有以下几种方式: 导入Android Jar包 导出游戏为Android项目(在Build时选中Google Android Project,这种方法可以参考将Unity3 ...
- 在WPF中调用Winform控件
最近在项目中用到了人脸识别和指纹识别,需要调用外部设备和接口,这里就用到了在WPF中调用Winform控件. 第一步,添加程序集引用.System.Windows.Forms和WindowsForms ...
- DB2执行脚本
经常会遇到数据库脚本放在.sql文件中,那么怎么去执行这个脚本,而不需要将脚本中的东西粘贴出来再数据库链接工具中执行呢? 下面是DB2数据库脚本执行的办法 环境介绍: 脚本文件名:Script.sql ...
- Android开发初始
由于本人一直的主攻方向是.NET平台,所以移动开发方面主要是Windows Phone平台,但是确实Windows Phone的市场占有率太小了,在加上本人是个技术迷,希望尝试新的东西,所以Andro ...
- C# 获取图片的EXIF 信息
关于 EXIF 信息的介绍. 1 EXIF,是英文Exchangeable Image File(可交换图像文件)的缩写.EXIF是一种图像文件格式,只是文件的后缀名为jpg.EXIF信息是由数码相 ...
- 微软开放技术(中国)携 CKAN 和 OData 技术引入基于 Azure 的开放数据平台
今天,微软开放技术(中国)通过微软公有云Azure引入一个全新的开放数据平台,该平台基于开源数据门户解决方案 CKAN,以及由微软开放技术(中国)特别针对中国市场优化的ODATA插件来增强其国际化和本 ...