제출 #227700

#제출 시각아이디문제언어결과실행 시간메모리
227700emil_physmath거래 (IZhO13_trading)C++17
100 / 100
377 ms35424 KiB
#include <algorithm> #include <iostream> #include <vector> #include <set> using namespace std; int main() { ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); int n, m; cin >> n >> m; vector<vector<int>> a(n + 1), b(n + 1); for (int i = 0; i < m; ++i) { int l, r, x; cin >> l >> r >> x; --l; --r; a[l].push_back(x - l); b[r + 1].push_back(x - l); } multiset<int> s; for (int i = 0; i < n; ++i) { for (int x: a[i]) s.insert(x); for (int x: b[i]) s.erase(s.find(x)); if (s.empty()) cout << 0 << ' '; else cout << i + *s.rbegin() << ' '; } }
#Verdict Execution timeMemoryGrader output
Fetching results...