# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
969876 | VMaksimoski008 | Trading (IZhO13_trading) | C++17 | 402 ms | 34156 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;
int main() {
int n, q;
cin >> n >> q;
vector<int> L[n+1], R[n+1];
for(int i=0; i<q; i++) {
int l, r, k;
cin >> l >> r >> k;
L[l].push_back(k - l);
R[r].push_back(k - l);
}
multiset<int> ms;
for(int i=1; i<=n; i++) {
for(int &x : L[i]) ms.insert(x);
if(ms.empty()) cout << 0 << " ";
else cout << i + *ms.rbegin() << " ";
for(int &x : R[i]) ms.erase(ms.find(x));
}
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |