제출 #4777

#제출 시각아이디문제언어결과실행 시간메모리
4777gs13068거래 (IZhO13_trading)C++98
100 / 100
396 ms22756 KiB
#include<cstdio> #include<vector> #include<set> struct hat { bool type; int x; } h; std::vector<hat> d[300001]; std::multiset<int> s; std::multiset<int>::iterator it; int main() { int a,b,c; int i,j,n,m; scanf("%d%d",&n,&m); for(i=0;i<m;i++) { scanf("%d%d%d",&a,&b,&c); h.x=c-a; h.type=false; d[a].push_back(h); h.type=true; d[b+1].push_back(h); } for(i=1;i<=n;i++) { for(j=0;j<d[i].size();j++) { if(d[i][j].type) s.erase(s.find(d[i][j].x)); else s.insert(d[i][j].x); } if(s.empty())printf("0 "); else { it=s.end(); it--; printf("%d ",*it+i); } } }
#Verdict Execution timeMemoryGrader output
Fetching results...