#include <bits/stdc++.h>
#define int long long
#define F first
#define S second
#define pb push_back
using namespace std;
const int N = 1e6 + 10;
const int inf = 1e15;
const int mod = 1e9 + 7;
signed main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
int n;
cin >> n;
vector<int>x(n + 1),g(n + 1),e(n + 1);
for(int i = 1; i <= n; i++) {
cin >> x[i] >> g[i] >> e[i];
g[i] += g[i - 1];
e[i] += e[i - 1];
}
int res = 0;
for(int i = 1; i <= n; i++) {
for(int j = 1; j <= i; j++) {
if(e[i] - e[j - 1] >= x[i] - x[j]) res = max(res,g[i] - g[j - 1]);
}
}
cout << res;
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |