1 条题解
-
1
#include<iostream> #include<algorithm> #include<cstdio> #include<cstring> #include<queue> using namespace std; struct node{ int id,st,re,pr; bool operator < (const node &a)const{ if(pr==a.pr) return st>a.st; else return pr<a.pr; } }; node c; long long ti; priority_queue<node>q; int main(){ while(scanf("%d%d%d%d",&c.id,&c.st,&c.re,&c.pr)!=EOF){ while(!q.empty()&&ti+q.top().re<=c.st){ node b=q.top(); q.pop(); printf("%d %lld\n",b.id,ti+b.re); ti+=b.re; } if(!q.empty()){ node d=q.top(); q.pop(); d.re=d.re-c.st+ti; q.push(d); } q.push(c); ti=c.st; } while(!q.empty()){ node f=q.top(); q.pop(); ti+=f.re; printf("%d %lld\n",f.id,ti); } return 0; }
- 1
信息
- ID
- 1230
- 时间
- 1000ms
- 内存
- 125MiB
- 难度
- 5
- 标签
- 递交数
- 1
- 已通过
- 1
- 上传者