This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define f(i,a,b) for(int i = a; i < b; i++)
const int N = 1e5 + 5;
int n;
ll a[N], g[N], e[N], sg[N], se[N], ans;
int main(){
cin >> n;
f(i,1,n+1) {
cin >> a[i] >> g[i] >> e[i];
sg[i] = sg[i-1] + g[i];
se[i] = se[i-1] + e[i];
}
f(i,1,n+1){
f(j,i,n+1){
if(se[j]-se[i-1] >= a[j]-a[i]){
ans = max(ans, sg[j]-sg[i-1]);
}
}
}
cout << ans << "\n";
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... |