#include <cstdio>
#include <algorithm>
using namespace std;
int n;
long long x[100005], g[100005], d[100005];
int main(){
scanf("%d",&n);
for (int i=1; i<=n; i++) {
scanf("%lld %lld %lld",&x[i],&g[i],&d[i]);
d[i] += d[i-1];
g[i] += g[i-1];
}
long long r = 0;
for (int i=1; i<=n; i++) {
for (int j=i; j<=n; j++) {
if(x[j] - x[i] <= d[j] - d[i-1]){
r = max(r,g[j] - g[i-1]);
}
}
}
printf("%lld",r);
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
3428 KB |
Output is correct |
2 |
Correct |
0 ms |
3428 KB |
Output is correct |
3 |
Correct |
0 ms |
3428 KB |
Output is correct |
4 |
Correct |
0 ms |
3428 KB |
Output is correct |
5 |
Correct |
0 ms |
3428 KB |
Output is correct |
6 |
Correct |
0 ms |
3428 KB |
Output is correct |
7 |
Correct |
0 ms |
3428 KB |
Output is correct |
8 |
Correct |
0 ms |
3428 KB |
Output is correct |
9 |
Correct |
0 ms |
3428 KB |
Output is correct |
10 |
Correct |
0 ms |
3428 KB |
Output is correct |
11 |
Correct |
0 ms |
3428 KB |
Output is correct |
12 |
Correct |
0 ms |
3428 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
3428 KB |
Output is correct |
2 |
Correct |
0 ms |
3428 KB |
Output is correct |
3 |
Correct |
0 ms |
3428 KB |
Output is correct |
4 |
Correct |
0 ms |
3428 KB |
Output is correct |
5 |
Correct |
0 ms |
3428 KB |
Output is correct |
6 |
Correct |
3 ms |
3428 KB |
Output is correct |
7 |
Correct |
0 ms |
3428 KB |
Output is correct |
8 |
Correct |
0 ms |
3428 KB |
Output is correct |
9 |
Correct |
0 ms |
3428 KB |
Output is correct |
10 |
Correct |
0 ms |
3428 KB |
Output is correct |
11 |
Correct |
16 ms |
3428 KB |
Output is correct |
12 |
Correct |
16 ms |
3428 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
25 ms |
3428 KB |
Output is correct |
2 |
Correct |
109 ms |
3428 KB |
Output is correct |
3 |
Correct |
105 ms |
3428 KB |
Output is correct |
4 |
Execution timed out |
1000 ms |
3424 KB |
Program timed out |
5 |
Halted |
0 ms |
0 KB |
- |