#include <bits/stdc++.h>
using namespace std;
#define ll long long
ll v[300002];
int main()
{
ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
ll n,m;
cin >> n >> m;
ll x,y,z;
for (int i=0;i<m;i++) {
cin >> x >> y >> z;
x--;
y--;
for (int j=0;j<=y-x;j++) {
v[x+j]=max(v[x+j],z+j);
}
}
for (int i=0;i<n;i++) {
cout << v[i] <<' ';
}
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
0 ms |
348 KB |
Output is correct |
4 |
Correct |
1 ms |
344 KB |
Output is correct |
5 |
Correct |
1 ms |
344 KB |
Output is correct |
6 |
Correct |
2 ms |
348 KB |
Output is correct |
7 |
Correct |
1372 ms |
4944 KB |
Output is correct |
8 |
Execution timed out |
2017 ms |
5776 KB |
Time limit exceeded |
9 |
Halted |
0 ms |
0 KB |
- |