hdoj 4883 TIANKENG’s restaurant【贪心区间覆盖】
TIANKENG’s restaurant
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 131072/65536 K (Java/Others)
Total Submission(s): 1360 Accepted Submission(s): 545
Each cases has a positive integer n(1<=n<=10000), which means n groups of customer. Then following n lines, each line there is a positive integer Xi(1<=Xi<=100), referring to the sum of the number of the ith group people, and the arriving time STi and departure time Edi(the time format is hh:mm, 0<=hh<24, 0<=mm<60), Given that the arriving time must be earlier than the departure time.
Pay attention that when a group of people arrive at the restaurant as soon as a group of people leaves from the restaurant, then the arriving group can be arranged to take their seats if the seats are enough.
#include<stdio.h>
#include<string.h>
#include<algorithm>
#define MAX 10010
using namespace std;
struct node
{
int come;
int go;
int peo;
}s[MAX];
int dp[MAX];
bool cmp(int a,int b)
{
return a>b;
}
int main()
{
int t,n,m,j,i;
int ha,hb,ma,mb;
scanf("%d",&t);
while(t--)
{
scanf("%d",&n);
memset(dp,0,sizeof(dp));
for(i=0;i<n;i++)
{
scanf("%d %d:%d %d:%d",&s[i].peo,&ha,&ma,&hb,&mb);
s[i].come=ha*60+ma;
s[i].go=hb*60+mb;
for(j=s[i].come;j<s[i].go;j++)
{
dp[j]+=s[i].peo;
}
}
sort(dp,dp+MAX,cmp);
printf("%d\n",dp[0]);
}
return 0;
}
hdoj 4883 TIANKENG’s restaurant【贪心区间覆盖】的更多相关文章
- HDOJ 4883 TIANKENG’s restaurant
称号: TIANKENG's restaurant Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 131072/65536 K (Ja ...
- hdoj 1050 Moving Tables【贪心区间覆盖】
Moving Tables Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Tot ...
- 高效算法——E - 贪心-- 区间覆盖
E - 贪心-- 区间覆盖 题目链接:http://acm.hust.edu.cn/vjudge/contest/view.action?cid=85904#problem/E 解题思路: 贪心思想, ...
- 【题解】Cut the Sequence(贪心区间覆盖)
[题解]Cut the Sequence(贪心区间覆盖) POJ - 3017 题意: 给定一大堆线段,问用这些线段覆盖一个连续区间1-x的最小使用线段的数量. 题解 考虑一个这样的贪心: 先按照左端 ...
- UVA 10382 - Watering Grass【贪心+区间覆盖问题+高精度】
UVa 10382 - Watering Grass n sprinklers are installed in a horizontal strip of grass l meters long a ...
- 南阳OJ-12-喷水装置(二)贪心+区间覆盖
题目链接: http://acm.nyist.edu.cn/JudgeOnline/problem.php?pid=12 题目大意: 有一块草坪,横向长w,纵向长为h,在它的橫向中心线上不同位置处装有 ...
- nyoj 12——喷水装置二——————【贪心-区间覆盖】
喷水装置(二) 时间限制:3000 ms | 内存限制:65535 KB 难度:4 描述 有一块草坪,横向长w,纵向长为h,在它的橫向中心线上不同位置处装有n(n<=10000)个点状的 ...
- 51nod 1091 线段的重叠【贪心/区间覆盖类】
1091 线段的重叠 基准时间限制:1 秒 空间限制:131072 KB 分值: 5 难度:1级算法题 收藏 关注 X轴上有N条线段,每条线段包括1个起点和终点.线段的重叠是这样来算的,[10 2 ...
- HDU 4883 TIANKENG’s restaurant Bestcoder 2-1(模拟)
TIANKENG's restaurant Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 131072/65536 K (Java/O ...
随机推荐
- js小分享
之前实现一些js代码时,总觉得无法下手,所以最近在学习一下特别细的知识点,分享笔记.嘻嘻,偷个小懒,我把自己的笔记拍个照片就不打字了.嘎嘎,放心放心,自觉得字写的还算ok的啦- 表示家里的老弟玩游戏, ...
- eclipse和cygwin搭建C++环境的修正版本
最近嫌弃切换系统麻烦.用了cygwin作为netbeans下C++的环境继续学习.我学的很渣,就不卖弄了. 网络上有很多这样的文章.经过对比和实验发现一个深坑.教程部分还是跟其他的一样,重点部分红字做 ...
- 实现基于Memcache存储的Session类
自主实现Session功能的类,基于文件方式存储Session数据,测试基本通过,还比较好玩,实际应用没有意义,只不过是学习Session是如何实现的. 使用基于文件的Session存取瓶颈可能都是在 ...
- v880 debug
zte v880手机,ubuntu中配置真机调试, 1.开启手机调试模式2.增加/etc/udev/rules.d/51-android.rules. 内容如下:SUBSYSTEM=="us ...
- 理解ThreadLocal背后的概念
介绍 我之前在任何场合都没有使用过thread local,因此没有注意到它,直到最近用到它的时候. 前提信息 线程可以理解为一个单独的进程,它有自己的调用栈.在java中每一个线程都有一个调用栈或者 ...
- 开发中遇到的angularJs的小问题
1.在使用自定义指令后如果需要将指令内部的数据传给外层controller需要设置scope属性,此时注意,如果指令内传出的数据在某种情况下需要清空,如传出一个选中元素的数组,点击清空按钮则清空选中这 ...
- 什么XSS攻击?PHP防止XSS攻击函数
什么XSS攻击?PHP防止XSS攻击函数 发布时间: 2013-05-14 浏览次数:22325 分类: PHP教程 XSS 全称为 Cross Site Scripting,用户在表单中有意或无意输 ...
- sql server 数据库基础学习心得 思维导图
- 《python源码剖析》笔记一——python编译
1.python的架构: 2.python源码的组织结构: 3.windows环境下编译python:
- 关于java reflect
反射的基石 Class类 对比提问: Person类代表人,它的实例对象就是张三,李四这样一个个具体的人, Java程序中的各个Java类属于同一类事物,描述这类事物的Java类名就是Class.对比 ...