#include <bits/stdc++.h>
using namespace std;
#define lo long
int d[100003],j[100003];
int g[100003],ans,h[100003];
int x[100003],n;
int main(){std::ios::sync_with_stdio(false);
ifstream cin("devide.in");
ofstream cout("devide.out");
cin>>n;
for(int i=0;i<n;i++)
{
cin>>x[i]>>g[i]>>d[i];
j[i]=j[i-1]+d[i];
// cout<<j[i]<<" ";
h[i]=h[i-1]+g[i];
// cout<<h[i]<<endl;
}
for(int i=0;i<n;i++)
{
for(int q=i;q<n;q++)
{
// cout<<j[q]<<" "<<j[i]<<" "<<x[q]<<" "<<x[i]<<" +++++"<<endl;
if(j[q]-j[i-1]>=x[q]-x[i])
{
ans=max(ans,h[q]-h[i-1]);
}
}
}
cout<<ans<<endl;
}
/*
* *
* * * *
* * * *
* * * *
* * * *
* * *
* *
* *
* *
* *
* *
* *
* *
* *
*
*/
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
4128 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
4128 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
4128 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |