Submission #1053025

#TimeUsernameProblemLanguageResultExecution timeMemory
1053025kachim2Trading (IZhO13_trading)C++17
0 / 100
2076 ms2536 KiB
#include<bits/stdc++.h> using namespace std; int nin(){ int x; cin >> x; return x; } int main(){ ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); const int n = nin(), m = nin(); vector<int> segtree(n, INT_MIN); auto update = [&segtree](int l, int r, int v){ for(int i = l; i <=r; i++){ segtree[i]= max(segtree[i], v); } }; auto query = [&segtree](int n){ return segtree[n]; }; for(int i = 0; i < m; i++){ const int l = nin()-1, r = nin()-1; const int v = nin()-l; update(l, r, v); } for(int i = 0; i < n; i++){ cout << max(0, query(i)+i) << ' '; } }
#Verdict Execution timeMemoryGrader output
Fetching results...