# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
343254 | apostoldaniel854 | Trading (IZhO13_trading) | C++14 | 10 ms | 14444 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;
#define pb push_back
#define dbg(x) cerr << #x << " " << x << "\n"
using ll = long long;
const int MAX_N = 3e5;
vector <int> to_add[1 + MAX_N], to_erase[1 + MAX_N + 1];
int main () {
ios::sync_with_stdio (false);
cin.tie (0); cout.tie (0);
int n, m;
cin >> n >> m;
for (int i = 1; i <= m; i++) {
int l, r, x;
cin >> l >> r >> x;
to_add[l].pb (x - i);
to_erase[r + 1].pb (x - i);
}
multiset <int> hat_prices;
for (int i = 1; i <= n; i++) {
for (int x : to_add[i])
hat_prices.insert (x);
for (int x : to_erase[i])
hat_prices.erase (hat_prices.find (x));
if (hat_prices.size () == 0)
cout << "0 ";
else
cout << *prev (hat_prices.end ()) + i << " ";
}
cout << "\n";
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |