제출 #960546

#제출 시각아이디문제언어결과실행 시간메모리
960546nguyennh거래 (IZhO13_trading)C++14
100 / 100
253 ms36556 KiB
#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 timeMemoryGrader output
Fetching results...