#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 time |
Memory |
Grader output |
1 |
Incorrect |
10 ms |
14444 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |