Submission #991188

#TimeUsernameProblemLanguageResultExecution timeMemory
991188tch1cherinTrading (IZhO13_trading)C++17
0 / 100
1 ms348 KiB
#include <bits/stdc++.h> using namespace std; int main() { cin.tie(nullptr)->sync_with_stdio(false); int N, M; cin >> N >> M; vector<int> L(M), R(M), X(M); vector<vector<int>> add(N); for (int i = 0; i < M; i++) { cin >> L[i] >> R[i] >> X[i]; L[i]--; add[L[i]].push_back(X[i] - L[i]); } vector<vector<int>> events(N); multiset<int> S; for (int i = 0; i < N; i++) { for (int x : events[i]) { S.erase(S.find(x)); } for (int x : add[i]) { S.insert(x); } cout << (S.empty() ? 0 : *S.rbegin() + i) << " \n"[i + 1 == N]; if (R[i] < N) { events[R[i]].push_back(X[i] - L[i]); } } }
#Verdict Execution timeMemoryGrader output
Fetching results...