1 条题解
-
0
C++ :
#include<bits/stdc++.h> using namespace std; struct Node{ int h,e; bool operator <(const Node &a)const{return h<a.h;} }; int n,b,h,e,H,E,c,x; priority_queue<Node>Q; int main(){ cin>>n>>b>>h>>e; printf("(%d,%d)",b,h);H=h;E=e; for(int i=2;i<=n;i++){ cin>>b>>h>>e; if(b>E){ while(!Q.empty()){ if(Q.top().e<=E)Q.pop(); else {printf("(%d,%d)",E,Q.top().h);H=Q.top().h;E=Q.top().e;} } } if(b>E){printf("(%d,0)",E);H=0;E=b;} if(h==H){if(e>E)E=e;} else if(h<H){if(e>E)Q.push((Node){h,e});} else {printf("(%d,%d)",b,h);if(E>e)Q.push((Node){H,E});H=h;E=e;} } printf("(%d,0)",E); return 0; }
- 1
信息
- ID
- 1812
- 时间
- 1000ms
- 内存
- 16MiB
- 难度
- (无)
- 标签
- 递交数
- 0
- 已通过
- 0
- 上传者