# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
47578 | dqhungdl | Trading (IZhO13_trading) | C++17 | 437 ms | 30212 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;
int n,T;
vector<int> g1[300005],g2[300005];
multiset<int> s;
int main()
{
ios_base::sync_with_stdio(false);
//freopen("TEST.INP","r",stdin);
//freopen("TEST.OUT","w",stdout);
cin>>n>>T;
int l,r,x;
while(T--)
{
cin>>l>>r>>x;
g1[l].push_back(x-l);
g2[r].push_back(x-l);
}
for(int i=1;i<=n;i++)
{
for(int j=0;j<g1[i].size();j++)
s.insert(g1[i][j]);
if(s.size()==0)
cout<<0<<' ';
else
cout<<*s.rbegin()+i<<' ';
for(int j=0;j<g2[i].size();j++)
s.erase(s.find(g2[i][j]));
}
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |