제출 #867473

#제출 시각아이디문제언어결과실행 시간메모리
867473sleepntsheep거래 (IZhO13_trading)C++17
100 / 100
273 ms6596 KiB
#include<bits/stdc++.h> using namespace std;int n,m,j;priority_queue<pair<int, int>> q; int main() {cin>>n>>m;vector<tuple<int,int,int>>v(m);for(auto&[l,r,x]:v)cin>>l>>r>>x;sort(v.begin(),v.end());for(int f,i=1;i<=n;++i){for(;get<0>(v[j])==i;q.emplace(get<2>(v[j])-get<0>(v[j]),get<1>(v[j])),++j); for(f=0;q.size()&&!f;){auto[z,r]=q.top();if(r>=i)cout<<i+z<<' ',f=1;else q.pop();}if(!f)cout<<"0 ";}}
#Verdict Execution timeMemoryGrader output
Fetching results...