这题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的更多相关文章

  1. hdu---(2604)Queuing(矩阵快速幂)

    Queuing Time Limit: 10000/5000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Total Su ...

  2. 【递推+矩阵快速幂】【HDU2604】【Queuing】

    Queuing Time Limit: 10000/5000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others) Total S ...

  3. Message Queuing(MSMQ)

    一.前言 MicroSoft Message Queuing(微软消息队列)是在多个不同的应用之间实现相互通信的一种异步传输模式,相互通信的应用可以分布于同一台机器上,也可以分布于相连的网络空间中的任 ...

  4. Queuing(以前写的没整理)

    Queuing Time Limit: 10000/5000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others) Total Subm ...

  5. 排队时延(Queuing delay)

    网络时延的构成 Network delay including four parts: Processing delay - time routers take to process the pack ...

  6. HTB Linux queuing discipline manual - user guide笔记

    1. Introduction HTB is meant as a more understandable, intuitive and faster replacement for the CBQ ...

  7. HDU 2604 Queuing(矩阵快速幂)

    题目链接:Queuing 题意:有一支$2^L$长度的队伍,队伍中有female和male,求$2^L$长度的队伍中除 fmf 和 fff 的队列有多少. 题解:先推导递推式:$f[i]=f[i-1] ...

  8. HDU 2604 Queuing(递推+矩阵)

    Queuing [题目链接]Queuing [题目类型]递推+矩阵 &题解: 这题想是早就想出来了,就坑在初始化那块,只把要用的初始化了没有把其他的赋值为0,调了3,4个小时 = = 本题是可 ...

  9. HDU - 2604 Queuing(递推式+矩阵快速幂)

    Queuing Time Limit: 10000/5000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Total Su ...

随机推荐

  1. 为gitlab10.x增加使用remote_user HTTP头的方式登录

    项目的结构是这样的: 客户端通过Apache来访问后端的gitlab(gitlab的版本是10.4,手动从源码安装的简体中文版) , Apache作为gitlab的反向代理服务器 Apache内置了C ...

  2. CentOS 安装PostregSQL9.2 同时出现pg安装错误

    错误: Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension. /usr/local/bin ...

  3. Css中!important的用法

    !important为开发者提供了一个增加样式权重的方法.应当注意的是!important是对整条样式的声明,包括这个样式的属性和属性值 <!DOCTYPE HTML> <html& ...

  4. windows网卡共享网络时,报Internet连接共享访问被启用时,出现了一个错误。(null)

    今天笔者在自己电脑上作试验时,准备将无线网络连接共享给VMnet1时报Internet连接共享访问被启用时,出现了一个错误.(null)错误: 经上网查询到问题原因:没有启用 Windows Fire ...

  5. python unittest框架中addCleanup函数详解

    接上一篇doCleanups说明,这次介绍下另一个很好用的函数:addCleanup 还是老规矩,看官方文档说明: addCleanup(function, *args, **kwargs)¶ Add ...

  6. TFS二次开发10——分组(Group)和成员(Member)

    TFS SDK 10 ——分组(Group)和成员(Member) 这篇来介绍怎样读取TFS服务器上的用户信息 首先TFS默认有如下分组(Group): SharePoint Web Applicat ...

  7. c++之list的用法

    list同vector一样是c++中的一个模板类.关于它的详细内容可查看c++的文档 http://www.cplusplus.com/reference/list/list/ C++中list的使用 ...

  8. ZOJ 4029 - Now Loading!!! - [前缀和+二分]

    题目链接:http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemCode=4029 Time Limit: 1 Second Memory L ...

  9. sql中把字符串转化为数字的方法

    1. convert(int,字段名) 2. cast(字段名 as int)

  10. 自定义vueawesomeswiper分页器样式

    swiperOption: {//swiper的配置项 notNextTick: true,//想获得swiper实例对象,这个必须为true direction: 'vertical', // gr ...