10588 - Queuing at the doctors
这题wa 了 八次 你说 巨弱 orz 大神 总结一下 没有将所有的情况考虑清楚 ,当有的时候一个人已经全部看完的时候 别的人还没开始 但是我就把他给结束了
#include <iostream>
#include<queue>
#include<cstdio>
using namespace std;
const int maxn=1100;
struct point{
long long ti;
int num;
bool operator <(const point &a)const{
return ti>a.ti||(ti==a.ti&&num>a.num);
}
};
priority_queue<point> doc[maxn];
queue<int>pat[maxn];
int main()
{
int t;
point temp;
scanf("%d",&t);
while(t--){
int n,m,d;
long long first=0,after=0,cur,ans=0,T;
scanf("%d%d",&n,&m);
for(int i=1;i<=n;i++){
int cas;
cin>>temp.ti>>cas;
temp.num=i;
if(cas>0){
++first; scanf("%d",&d); doc[d].push(temp); cas--;
}
while(cas--){
scanf("%d",&d);
++first;
pat[i].push(d);
}
}
cur=-1;
T=-2;
while(first!=after){ if(T>cur) cur=T;
else cur++;
T=100000000;
for(int i=1;i<=m;i++)
if(!doc[i].empty()){
temp=doc[i].top();
if(temp.ti<=cur){
T=cur;
++after;
ans=cur+1;
doc[i].pop();
if(!pat[temp.num].empty()){
d=pat[temp.num].front();
pat[temp.num].pop();
temp.ti=cur+1;
doc[d].push(temp);
}
}
else T=T>temp.ti?temp.ti:T;
}
if(first==after) break; }
cout<<ans<<endl;
} return 0;
}
10588 - Queuing at the doctors的更多相关文章
- hdu---(2604)Queuing(矩阵快速幂)
Queuing Time Limit: 10000/5000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Su ...
- 【递推+矩阵快速幂】【HDU2604】【Queuing】
Queuing Time Limit: 10000/5000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others) Total S ...
- Message Queuing(MSMQ)
一.前言 MicroSoft Message Queuing(微软消息队列)是在多个不同的应用之间实现相互通信的一种异步传输模式,相互通信的应用可以分布于同一台机器上,也可以分布于相连的网络空间中的任 ...
- Queuing(以前写的没整理)
Queuing Time Limit: 10000/5000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others) Total Subm ...
- 排队时延(Queuing delay)
网络时延的构成 Network delay including four parts: Processing delay - time routers take to process the pack ...
- HTB Linux queuing discipline manual - user guide笔记
1. Introduction HTB is meant as a more understandable, intuitive and faster replacement for the CBQ ...
- HDU 2604 Queuing(矩阵快速幂)
题目链接:Queuing 题意:有一支$2^L$长度的队伍,队伍中有female和male,求$2^L$长度的队伍中除 fmf 和 fff 的队列有多少. 题解:先推导递推式:$f[i]=f[i-1] ...
- HDU 2604 Queuing(递推+矩阵)
Queuing [题目链接]Queuing [题目类型]递推+矩阵 &题解: 这题想是早就想出来了,就坑在初始化那块,只把要用的初始化了没有把其他的赋值为0,调了3,4个小时 = = 本题是可 ...
- HDU - 2604 Queuing(递推式+矩阵快速幂)
Queuing Time Limit: 10000/5000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Su ...
随机推荐
- redmine3.3.0安装问题
1.An error occurred while installing rmagick (2.16.0), and Bundler cannot continue. Make sure that ` ...
- !important:element.style 覆盖样式问题
问题: 浏览器F12看到是这个样子. 但是我设置的样式是这样子. #iframe_close { width:750px; } 无论怎么设置样式,都无法覆盖掉element.style的样式,widt ...
- 23种设计模式之命令模式(Command)
命令模式是一种对象的行为型模式,类似于传统程序设计方法中的回调机制,它将一个请求封装为一个对象,从而使得可用不同的请求对客户进行参数化:对请求排队或者记录请求日志,以及支持可撤销的操作.命令模式是对命 ...
- Android控件开发——ListView
上篇博客解决了Android客户端通过WebService与服务器端程序进行交互的问题,这篇博客重点关注两个问题,一个是Android应用程序如何与本机文件型数据库SQLite进行交互,另一问题则是如 ...
- Unity3D笔记 英保通十 射线碰撞器检测
射线碰撞检测可以用来检测方向和距离: 通过Physics.RayCast光线投射来实现:常用于射击利用发射的射线来判断.还有对战中刀剑交战中.. 一.要涉及到RayCast和RayCastHit 1. ...
- jQuery ajax的前台代码编写
jQuery ajax的前台代码: <script type="text/javascript" src="/include/jquery/jquery-1.1.3 ...
- ubuntu16.04下安装文献管理工具mendelay
1.首先下载mendelay的安装包 到官网下载对应版本的安装包,官网地址:Download for Ubuntu and Kubuntu 16.04 LTS, 17.04 and Debian 2. ...
- POJ 2987 - Firing - [最大权闭合子图]
题目链接:http://poj.org/problem?id=2987 Time Limit: 5000MS Memory Limit: 131072K Description You’ve fina ...
- 七种RAID技术
想把好多硬盘组在一起使用的基本方式为:连接所有硬盘,先向第一个硬盘中写数据,满了之后,再向第二个硬盘上写数据,如此只是简单的连通了多个硬盘. 再此基础上发展了RAID技术:由独立磁盘组成的具有冗余特性 ...
- hadoop的两类配置文件及3种启动/关闭方式
hadoop配置文件 默认配置文件:四个模块相对应的jar包中:$HADOOP_HOME/share/hadoop *core-default.xml *hdfs-defa ...