# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1101386 | ezzzay | Trading (IZhO13_trading) | C++14 | 229 ms | 26432 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#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 time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |