제출 #1101386

#제출 시각아이디문제언어결과실행 시간메모리
1101386ezzzay거래 (IZhO13_trading)C++14
100 / 100
229 ms26432 KiB
#include<bits/stdc++.h> using namespace std; #define ff first #define ss second #define pb push_back const int N=3e5+5;; int x[N]; int l[N],r[N]; int a[N]; vector<pair<int,int>> vc[N]; signed main(){ int n,m; cin>>n>>m; for(int i=1;i<=m;i++){ cin>>l[i]>>r[i]>>x[i]; vc[l[i]].pb({x[i]-l[i],r[i]}); } priority_queue<pair<int,int>>q; for(int i=1;i<=n;i++){ for(auto p:vc[i]){ q.push(p); } while(!q.empty() and q.top().ss<i){ q.pop(); } if(q.empty()){ cout<<0<<" "; } else{ cout<<i+q.top().ff<<" "; } } }
#Verdict Execution timeMemoryGrader output
Fetching results...