# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
342783 | Gurban | Trading (IZhO13_trading) | C++17 | 379 ms | 35468 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;
using ll = long long;
const int maxn=3e5+5;
int n,m,l,r,x;
multiset<int>s;
vector<int>L[maxn],R[maxn];
int main(){
ios::sync_with_stdio(false);
cin.tie(0);
cin >> n >> m;
for(int i = 1;i <= m;i++){
cin >> l >> r >> x;
L[l].push_back(x-l);
R[r].push_back(x-l);
}
for(int i = 1;i <= n;i++){
for(auto j : L[i]) s.insert(j);
int nw = 0;
if(!s.empty()) nw = *s.rbegin() + i;
cout<<nw<<' ' ;
for(auto j : R[i]) s.erase(s.find(j));
}
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |