# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
860150 | aykhn | Trading (IZhO13_trading) | C++14 | 371 ms | 64152 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>
// author : aykhn
using namespace std;
typedef long long ll;
#define pb push_back
#define ins insert
#define mpr make_pair
#define all(v) v.begin(), v.end()
#define bpc __builtin_popcount
#define pii pair<int, int>
#define pll pair<ll, ll>
#define fi first
#define se second
#define int ll
#define infll 0x3F3F3F3F3F3F3F3F
#define inf 0x3F3F3F3F
signed main()
{
ios_base::sync_with_stdio(0);
cin.tie(nullptr);
int n, m;
cin >> n >> m;
vector<multiset<int>> v1(n + 1);
vector<multiset<int>> v2(n + 2);
while (m--)
{
int l, r, x;
cin >> l >> r >> x;
v1[l].ins(x - l);
v2[r + 1].ins(x - l);
}
multiset<int> ms;
for (int i = 1; i <= n; i++)
{
for (int x : v2[i]) ms.erase(ms.lower_bound(x));
for (int x : v1[i]) ms.ins(x);
if (!ms.empty()) cout << *ms.rbegin() + i << " ";
else cout << 0 << " ";
}
cout << endl;
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |