# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
867473 | sleepntsheep | Trading (IZhO13_trading) | C++17 | 273 ms | 6596 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,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 time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |