# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1053025 | kachim2 | Trading (IZhO13_trading) | C++17 | 2076 ms | 2536 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 nin(){
int x;
cin >> x;
return x;
}
int main(){
ios_base::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
const int n = nin(), m = nin();
vector<int> segtree(n, INT_MIN);
auto update = [&segtree](int l, int r, int v){
for(int i = l; i <=r; i++){
segtree[i]= max(segtree[i], v);
}
};
auto query = [&segtree](int n){
return segtree[n];
};
for(int i = 0; i < m; i++){
const int l = nin()-1, r = nin()-1;
const int v = nin()-l;
update(l, r, v);
}
for(int i = 0; i < n; i++){
cout << max(0, query(i)+i) << ' ';
}
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |