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;
#define int long long
signed main(){
int n;
cin >> n;
vector <int> a(n), g(n), e(n);
for(int i = 0; i < n; i++){
cin >> a[i] >> g[i] >> e[i];
}
for(int i = 1; i < n; i++){
g[i] += g[i-1];
e[i] += e[i-1];
}
int ans = 0;
for(int i = 0; i < n; i++){
for(int j = i; j < n; j++){
int x = (e[j] - (i == 0 ? 0 : e[i-1]));
if(x >= (a[j]-a[i])){
ans = max(ans,(g[j] - (i == 0 ? 0 : g[i-1])));
}
}
}
cout << ans;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |