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 ...
随机推荐
- rpm包安装失败的解决办法
author: headsen chen date : 2018-10-15 14:24:36 1,故障现象: # rpm -ivh zabbix-agent--.el6.x86_64.rpm ...
- Xcode脚本自动化打包问题:xcrun: error: unable to find utility "PackageApplication", not a developer tool or in PATH
运行脚本后报错: xcrun: error: unable to find utility "PackageApplication", not a developer tool o ...
- 【C#】浏览器源代码
using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; usin ...
- thinkphp---设置路由
在做一个项目,在项目完成之后,配置一下路由,让URL更容易美观. 下面是具体的配置: Common / Conf / config.php // 路由处理 'URL_HTML_SUFFIX'=> ...
- Kibana在Linux上安装部署及使用说明
Kibana安装及使用说明 Kibana是一个针对Elasticsearch的开源分析及可视化平台,用来搜索.查看交互存储在Elasticsearch索引中的数据. 官方地址:https://www. ...
- poi 导入导出excel
import org.apache.poi.hssf.usermodel.HSSFSheet; import org.apache.poi.hssf.usermodel.HSSFWorkbook; i ...
- R数据可视化手册学习——条形图
1. 绘制简单条形图 # 使用ggplot2和gcookbook library(ggplot2); library(gcookbook) g <- ggplot(data = pg_mean, ...
- 【紫书】 The Falling Leaves UVA - 699 递归得简单
题意:给你一颗二叉树的前序遍历,空子树以-1表示,将左右子树的权值投影到一维数轴上,左儿子位置为根位置-1,右儿子+1求个个整点上的和: 题解:递归,整个过程只需维护一个sum数组. 更新根,更新le ...
- python3学习笔记(6)_iteration
#python3 学习笔记17/07/10 # !/usr/bin/env python3 # -*- coding:utf-8 -*- #类似 其他语言的for循环,但是比for抽象程度更高 # f ...
- 区块链,Ethereum-Wallet
https://blockchain.info/charts/transactions-per-second https://slock.it/ https://en.wikipedia.or ...