제출 #343254

#제출 시각아이디문제언어결과실행 시간메모리
343254apostoldaniel854거래 (IZhO13_trading)C++14
0 / 100
10 ms14444 KiB
#include <bits/stdc++.h> using namespace std; #define pb push_back #define dbg(x) cerr << #x << " " << x << "\n" using ll = long long; const int MAX_N = 3e5; vector <int> to_add[1 + MAX_N], to_erase[1 + MAX_N + 1]; int main () { ios::sync_with_stdio (false); cin.tie (0); cout.tie (0); int n, m; cin >> n >> m; for (int i = 1; i <= m; i++) { int l, r, x; cin >> l >> r >> x; to_add[l].pb (x - i); to_erase[r + 1].pb (x - i); } multiset <int> hat_prices; for (int i = 1; i <= n; i++) { for (int x : to_add[i]) hat_prices.insert (x); for (int x : to_erase[i]) hat_prices.erase (hat_prices.find (x)); if (hat_prices.size () == 0) cout << "0 "; else cout << *prev (hat_prices.end ()) + i << " "; } cout << "\n"; return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...