# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1116264 | Tsagana | Trading (IZhO13_trading) | C++14 | 215 ms | 36656 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>
#define IOS ios_base::sync_with_stdio(false);cin.tie();cout.tie();
#define all(x) x.begin(), x.end()
#define int long long
#define pq priority_queue
#define eb emplace_back
#define lb lower_bound
#define ub upper_bound
#define pb push_back
#define pp pop_back
#define F first
#define S second
using namespace std;
multiset<int> s;
vector<int> a[300001];
vector<int> b[300001];
void solve () {
int n, m; cin >> n >> m;
for (int i = 1; i <= m; i++) {
int l, r, k; cin >> l >> r >> k;
int x = l - k;
a[l].pb(x);
b[r].pb(x);
}
for (int i = 1; i <= n; i++) {
for (auto x: a[i]) s.insert(x);
cout << (s.empty() ? 0 : i - *s.begin()) << ' ';
for (auto x: b[i]) {
auto y = s.find(x);
if(y == s.end()) continue;
s.erase(y);
}
}
}
signed main() {IOS solve(); return 0;}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |