#include <bits/stdc++.h>
using namespace std;
#define FAST ios_base::sync_with_stdio(false); cin.tie(NULL);
#define fio(x) freopen(x".in","r",stdin);freopen(x".out","w",stdout)
void YES(bool t=1){std::cout<<(t?"YES\n":"NO\n");}
void NO(bool t=1){YES(!t);}
const int MOD = 1000000007;
//#define int long long
#define pb push_back
#define ll long long
#define all(x) (x).begin(), (x).end()
void solve() {
int n,m;
cin >> n >> m;
vector<int> a,b,c;
for(int i = 0; i < m; i++){
int x,y,z;
cin >> x >> y >> z;
a.pb(x);
b.pb(y);
c.pb(z);
}
for(int i = 1; i <= n; i++) {
int x=0;
for(int j = 0; j < m; j++) {
// cout << a[j] << " " << b[j] << " " << c[j] << endl;
if(a[j]<=i&&b[j]>=i)x=max(x,c[j]+i-a[j]);
}
cout << x << " ";
}
}
int main() {
FAST
solve();
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
348 KB |
Output is correct |
2 |
Correct |
1 ms |
348 KB |
Output is correct |
3 |
Correct |
1 ms |
348 KB |
Output is correct |
4 |
Correct |
2 ms |
348 KB |
Output is correct |
5 |
Correct |
6 ms |
348 KB |
Output is correct |
6 |
Correct |
13 ms |
528 KB |
Output is correct |
7 |
Execution timed out |
2091 ms |
2660 KB |
Time limit exceeded |
8 |
Halted |
0 ms |
0 KB |
- |