Submission #1116193

#TimeUsernameProblemLanguageResultExecution timeMemory
1116193TsaganaTrading (IZhO13_trading)C++14
0 / 100
5 ms4856 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]) { auto x = s.find(b[i]); s.erase(x); } } } signed main() {IOS solve(); return 0;}
#Verdict Execution timeMemoryGrader output
Fetching results...