# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
227700 | emil_physmath | Trading (IZhO13_trading) | C++17 | 377 ms | 35424 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 <algorithm>
#include <iostream>
#include <vector>
#include <set>
using namespace std;
int main()
{
ios::sync_with_stdio(0);
cin.tie(0); cout.tie(0);
int n, m;
cin >> n >> m;
vector<vector<int>> a(n + 1), b(n + 1);
for (int i = 0; i < m; ++i)
{
int l, r, x;
cin >> l >> r >> x;
--l; --r;
a[l].push_back(x - l);
b[r + 1].push_back(x - l);
}
multiset<int> s;
for (int i = 0; i < n; ++i)
{
for (int x: a[i])
s.insert(x);
for (int x: b[i])
s.erase(s.find(x));
if (s.empty())
cout << 0 << ' ';
else
cout << i + *s.rbegin() << ' ';
}
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |