Submission #1116195

#TimeUsernameProblemLanguageResultExecution timeMemory
1116195TsaganaTrading (IZhO13_trading)C++14
0 / 100
4 ms4688 KiB
#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; int a[300001]; 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] = b[r] = x; } for (int i = 1; i <= n; i++) { if (a[i]) s.insert(a[i]); cout << (s.empty() ? 0 : i - *s.begin()) << ' '; if (b[i] && !s.empty()) { auto x = s.find(b[i]); s.erase(x); } } } signed main() {IOS solve(); return 0;}
#Verdict Execution timeMemoryGrader output
Fetching results...