这题wa 了 八次 你说 巨弱  orz 大神   总结一下  没有将所有的情况考虑清楚 ,当有的时候一个人已经全部看完的时候 别的人还没开始 但是我就把他给结束了

  1. #include <iostream>
  2. #include<queue>
  3. #include<cstdio>
  4. using namespace std;
  5. const int maxn=1100;
  6. struct point{
  7. long long ti;
  8. int num;
  9. bool operator <(const point &a)const{
  10. return ti>a.ti||(ti==a.ti&&num>a.num);
  11. }
  12. };
  13. priority_queue<point> doc[maxn];
  14. queue<int>pat[maxn];
  15. int main()
  16. {
  17. int t;
  18. point temp;
  19. scanf("%d",&t);
  20. while(t--){
  21. int n,m,d;
  22. long long first=0,after=0,cur,ans=0,T;
  23. scanf("%d%d",&n,&m);
  24. for(int i=1;i<=n;i++){
  25. int cas;
  26. cin>>temp.ti>>cas;
  27. temp.num=i;
  28. if(cas>0){
  29. ++first; scanf("%d",&d); doc[d].push(temp); cas--;
  30. }
  31. while(cas--){
  32. scanf("%d",&d);
  33. ++first;
  34. pat[i].push(d);
  35. }
  36. }
  37. cur=-1;
  38. T=-2;
  39. while(first!=after){
  40.  
  41. if(T>cur) cur=T;
  42. else cur++;
  43. T=100000000;
  44. for(int i=1;i<=m;i++)
  45. if(!doc[i].empty()){
  46. temp=doc[i].top();
  47. if(temp.ti<=cur){
  48. T=cur;
  49. ++after;
  50. ans=cur+1;
  51. doc[i].pop();
  52. if(!pat[temp.num].empty()){
  53. d=pat[temp.num].front();
  54. pat[temp.num].pop();
  55. temp.ti=cur+1;
  56. doc[d].push(temp);
  57. }
  58. }
  59. else T=T>temp.ti?temp.ti:T;
  60. }
  61. if(first==after) break;
  62.  
  63. }
  64. cout<<ans<<endl;
  65. }
  66.  
  67. return 0;
  68. }

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. C99中的变长数组(VLA)

    处理二维数组的函数有一处可能不太容易理解,数组的行可以在函数调用的时候传递,但是数组的列却只能被预置在函数内部.例如下面这样的定义: #define COLS 4 int sum3d(int ar[] ...

  2. Unix/Linux 查看文件大小

    ls -l help.html-rw-r--r--  1 william  wheel  40960 Jul 18 00:59 development.sqlite3 40960 就是文件的大小. d ...

  3. 【Android】Android import和export使用说明 及 export报错:jarlist.cache: Resource is out of sync with the file syst解决

    在Android开发export项目时发现有时会报错,内容如下: Problems were encountered during export:  Error exporting PalmIdent ...

  4. jquery 设置style:display 其实很方便的哦

    ("#id").css('display','none'); $("#id").css('display','block'); 或 $("#id&qu ...

  5. POJ-2029 Get Many Persimmon Trees(动态规划)

    Get Many Persimmon Trees Time Limit: 1000MS Memory Limit: 30000K Total Submissions: 3987 Accepted: 2 ...

  6. TOP100summit 2017:微博如何做到1小时增加一千台服务器应对鹿晗恋情带来的流量暴增

    10月8日中午12点,鹿晗和关晓彤宣布恋情,年近30的我并不关心小鲜肉们的分分合合,但是作为壹佰案例这个软件研发行业自媒体的小编,我更关注因此引发的微博宕机事件. 鹿晗公布恋情的微博获得462884次 ...

  7. octomap的简介

    装载自高翔博士的博客:https://www.cnblogs.com/gaoxiang12/p/5041142.html 什么是octomap? RGBD SLAM的目的有两个:估计机器人的轨迹,并建 ...

  8. python中super的使用方法

    说白了,super的使用就是要子类要调用父类的方法,我们就用super,那你要有调用的规范,我们明白这个规范就可以了. 在python2和python3中,调用方法不同,注意就是了.Python3.x ...

  9. JSTL 学习

    对于页面访问数据的统计,可以使用内置对象的相应方法进行计数工作,这个对象要在jsp对象的整个生命周期中setAttribute()和getAttribute()application.setAttri ...

  10. Spring Cloud微服务开发笔记5——Ribbon负载均衡策略规则定制

    上一篇文章单独介绍了Ribbon框架的使用,及其如何实现客户端对服务访问的负载均衡,但只是单独从Ribbon框架实现,没有涉及spring cloud.本文着力介绍Ribbon的负载均衡机制,下一篇文 ...