Submission #1291187

#TimeUsernameProblemLanguageResultExecution timeMemory
1291187Mamikonm1Trading (IZhO13_trading)C++17
100 / 100
202 ms29428 KiB
#include <iostream> #include <vector> #include <cmath> #include <algorithm> #include <iomanip> #include <string> #include<stack> #include <set> #include <queue> #include <chrono> #include<array> #include<bitset> #include<unordered_map> #include<random> #include<cassert> using namespace std; using ll = long long; using db = double; const float pi = 3.14159265359; #define V vector #define VI V<int> #define P pair<int,int> #define rep(i, a, b, step) for (int i = int(a); i <= int(b); i += step) #define repl(i,a,b,step) for (int i = int(a); i >= int(b); i -= step) #define prime(n) [](ll x) { for (ll i = 2; i * i <= x; ++i) if (x % i == 0) return false; return x > 1; }(n) #define printall(container, ch) for (const auto& elem : container) { std::cout << elem << ch; } std::cout << std::endl; #define sn << '\n' #define ed << endl #define sz size() #define print cout << #define debug(x) cerr<< #x << " = " << x sn; #define mpII map<int,int> #define mine min_element #define maxe max_element #define all(v) begin(v), end(v) #define txt freopen("bomb.in", "r", stdin); freopen("bomb.out", "w", stdout) #define MEX(a) [](VI a){set<int>elem;for(auto&i:a)elem.insert(i);int ret=0;while(elem.count(ret))ret++;return ret;}(a) #define pb push_back #define pq priority_queue #define rev reverse #define nuyn(a) a.erase(unique(all(a)), end(a)) #define nx next_permutation #define pk pop_back() #define START print "Start" sn #define END print "End" sn #define ff first #define ss second #define ts to_string #define ub upper_bound #define mk make_pair #define lb lower_bound #define testcase int t;cin>>t;while(t--)solution(); int main() { ios_base::sync_with_stdio(false); cin.tie(nullptr); int n, m, x, l, r; cin >> n >> m; V<VI>del(n + 1), ins(n + 1); multiset<int>st; while (m--) { cin >> l >> r >> x; x -= l; ins[l].pb(x); if (r + 1 <= n)del[r + 1].pb(x); } rep(i, 1, n, 1) { for (auto& j : ins[i])st.insert(j); for (auto& j : del[i])st.erase(st.find(j)); print(st.empty() ? 0 : *st.rbegin() + i) << " \n"[i == n]; } }
#Verdict Execution timeMemoryGrader output
Fetching results...