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 ...
随机推荐
- C99中的变长数组(VLA)
处理二维数组的函数有一处可能不太容易理解,数组的行可以在函数调用的时候传递,但是数组的列却只能被预置在函数内部.例如下面这样的定义: #define COLS 4 int sum3d(int ar[] ...
- Unix/Linux 查看文件大小
ls -l help.html-rw-r--r-- 1 william wheel 40960 Jul 18 00:59 development.sqlite3 40960 就是文件的大小. d ...
- 【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 ...
- jquery 设置style:display 其实很方便的哦
("#id").css('display','none'); $("#id").css('display','block'); 或 $("#id&qu ...
- POJ-2029 Get Many Persimmon Trees(动态规划)
Get Many Persimmon Trees Time Limit: 1000MS Memory Limit: 30000K Total Submissions: 3987 Accepted: 2 ...
- TOP100summit 2017:微博如何做到1小时增加一千台服务器应对鹿晗恋情带来的流量暴增
10月8日中午12点,鹿晗和关晓彤宣布恋情,年近30的我并不关心小鲜肉们的分分合合,但是作为壹佰案例这个软件研发行业自媒体的小编,我更关注因此引发的微博宕机事件. 鹿晗公布恋情的微博获得462884次 ...
- octomap的简介
装载自高翔博士的博客:https://www.cnblogs.com/gaoxiang12/p/5041142.html 什么是octomap? RGBD SLAM的目的有两个:估计机器人的轨迹,并建 ...
- python中super的使用方法
说白了,super的使用就是要子类要调用父类的方法,我们就用super,那你要有调用的规范,我们明白这个规范就可以了. 在python2和python3中,调用方法不同,注意就是了.Python3.x ...
- JSTL 学习
对于页面访问数据的统计,可以使用内置对象的相应方法进行计数工作,这个对象要在jsp对象的整个生命周期中setAttribute()和getAttribute()application.setAttri ...
- Spring Cloud微服务开发笔记5——Ribbon负载均衡策略规则定制
上一篇文章单独介绍了Ribbon框架的使用,及其如何实现客户端对服务访问的负载均衡,但只是单独从Ribbon框架实现,没有涉及spring cloud.本文着力介绍Ribbon的负载均衡机制,下一篇文 ...