这题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;
}

最新文章

  1. LeetCode:Count and Say
  2. 利用jquery发送form表单
  3. MATLAB寻找数组前k个大值
  4. MUI(3)
  5. MVP
  6. 改善C#公共程序类库质量的10种方法
  7. [MetaHook] Quake FMOD function
  8. 137. Single Number II——问题是查找,本质是hash查找,只是记录的是32 bit中各个位出现次数而已
  9. poj 1247 The Perfect Stall 裸的二分匹配,但可以用最大流来水一下
  10. lght oj 1257 - Farthest Nodes in a Tree (II) (树dp)
  11. 射频识别技术漫谈(14)&mdash;&mdash;S50与S70存取控制【worldsing笔记】
  12. Cocos2d-x3.0TestCpp文件夹笔记(二)
  13. WPF仿微软事件和属性窗体,效果更炫!
  14. Where Jboss7.1 take war application to deploy--reference
  15. 管理SQL Server数据库服务器的安全防范原则
  16. Mysql中Key与Index的区别
  17. eclipse创建的maven项目无法部署到tomcat
  18. Java基础 成员变量的继承与覆盖
  19. byte在计算机中的存储方式--Double.byteValue()的输出结果思考
  20. Linux下通过server-status监控性能

热门文章

  1. Ruby require, load include 区别
  2. Maven Assembly插件介绍
  3. Unity3D笔记 模型和角色动画的输出设置
  4. Mongodb 副本集 数据同步简单测试
  5. ElasticSearch在linux上安装部署(转)
  6. ADOdb 支持的数据库包括哪些?
  7. FFT【快速傅里叶变换】FWT【快速沃尔什变换】
  8. .NET程序运行过程
  9. hihocoder 1320 - 压缩字符串 - [hiho一下160周]
  10. php 中date显示时间不对与Linux文件乱码问题