Submission #1101386

#TimeUsernameProblemLanguageResultExecution timeMemory
1101386ezzzayTrading (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...