# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
379956 | vishesh312 | Trading (IZhO13_trading) | C++17 | 1 ms | 364 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;
/*
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
using ordered_set = tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update>;
*/
#define all(x) begin(x), end(x)
#define sz(x) (int)x.size()
using ll = long long;
const int mod = 1e9+7;
void solve(int tc) {
int n, m;
cin >> n >> m;
vector<vector<int>> in(n), out(n);
while (m--) {
int l, r, x;
cin >> l >> r >> x;
--l, --r;
in[l].push_back(x-l);
out[r].push_back(x-l);
}
multiset<int> ms;
for (int i = 0; i < n; ++i) {
for (int x : in[i]) ms.insert(x);
cout << (ms.empty() ? 0 : *ms.rbegin() + i) << " ";
for (int x : out[i]) ms.erase(x);
}
}
signed main() {
ios_base::sync_with_stdio(false); cin.tie(NULL);
int tc = 1;
//cin >> tc;
for (int i = 1; i <= tc; ++i) solve(i);
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |