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;
int main() {
cin.tie(nullptr)->sync_with_stdio(false);
int N;
cin >> N;
vector<int> x(N), g(N), d(N);
for (int i = 0; i < N; i++) {
cin >> x[i] >> g[i] >> d[i];
}
long long answer = 0;
for (int i = 0; i < N; i++) {
long long sum_g = 0, sum_d = 0;
for (int j = i; j < N; j++) {
sum_g += g[j];
sum_d += d[j];
if (sum_d >= x[j] - x[i]) {
answer = max(answer, sum_g);
}
}
}
cout << answer << "\n";
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |