# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
960546 | nguyennh | Trading (IZhO13_trading) | C++14 | 253 ms | 36556 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 el '\n'
using namespace std ;
int32_t main (){
ios_base::sync_with_stdio(0);
cin.tie(0);
int n , m;
cin >> n >> m;
vector<vector<pair<int , int>>> lt(n + 5) , rt(n + 5);
for ( int i = 1 ; i <= m ; i++ ){
int l , r , x;
cin >> l >> r >> x;
lt[l].push_back(make_pair(r , x));
rt[r].push_back(make_pair(l , x));
}
multiset<int> store;
for ( int i = 1 ; i <= n ; i++ ){
for ( auto x : lt[i] ) store.insert(x.second - i);
if (store.empty()) cout << 0 << " ";
else cout << i + *store.rbegin() << " ";
for ( auto x : rt[i] ) store.erase(store.find(x.second - x.first));
}
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |