Submission #332085

#TimeUsernameProblemLanguageResultExecution timeMemory
332085nvmdavaTrading (IZhO13_trading)C++17
100 / 100
219 ms21864 KiB
#include <bits/stdc++.h> using namespace std; #define ll long long #define ff first #define ss second mt19937 rng(chrono::steady_clock::now().time_since_epoch().count()); const int N = 300'005; const ll MOD = 1'000'000'007; const int INF = 0x3f3f3f3f; priority_queue<pair<int, int> > pq; vector<pair<int, int> > add[N]; int main(){ ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); int n, m; cin>>n>>m; while(m--){ int l, r, x; cin>>l>>r>>x; add[l].push_back({x - l, r}); } for(int i = 1; i <= n; ++i){ for(auto& x : add[i]) pq.push(x); while(!pq.empty() && pq.top().ss < i) pq.pop(); if(pq.empty()) cout<<"0 "; else cout<<pq.top().ff + i<<' '; } }
#Verdict Execution timeMemoryGrader output
Fetching results...