# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
332085 | nvmdava | Trading (IZhO13_trading) | C++17 | 219 ms | 21864 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;
#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 time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |